Skip to content

Instantly share code, notes, and snippets.

View twesolowski's full-sized avatar

Tom Woo twesolowski

View GitHub Profile
@twesolowski
twesolowski / home_dir.php
Created February 7, 2017 12:43
home_dir.php
<?php
$home = getenv('HOME');
if (!empty($home)) {
$home = rtrim($home, '/');
}elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
$home = $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'];
$home = rtrim($home, '\\/');
}
return empty($home) ? NULL : $home;
@twesolowski
twesolowski / cleanEmtyTags.php
Created January 26, 2017 12:01
cleanEmtyTags
<?php
function cleanEmtyTags($input){
/* flags i - case insensitive, m-multiline */
/* replace tags containing entities only */
$input = preg_replace('@>(&.+;)<@mi', '><', $input);
/* remove empty tags */
return preg_replace('@(<(?!\/)[^>]+>)+(<\/[^>]+>)+@mi', '', $input);
@twesolowski
twesolowski / config.rb
Created November 24, 2016 12:06
Prestashop theme sass compass config
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"
fonts_dir = "fonts"
@twesolowski
twesolowski / RoboFile.php
Last active November 8, 2016 07:31
Prestashop - robofile
<?php
class RoboFile extends \Robo\Tasks
{
private $devDisableModules = [
"statsstock",
"statsvisits",
"statssearch",
"statssales",
"statsregistrations",
@twesolowski
twesolowski / category_product.sql
Created August 29, 2016 09:00
Prestashop - assign product to parent category
INSERT IGNORE INTO lew_category_product
SELECT
lew_category.id_parent id_category,
lew_category_product.id_product,
(SELECT IFNULL(MAX(position) + 1, 0) FROM lew_category_product lcp2 WHERE lcp2.id_category = lew_category.id_parent) position
FROM
lew_category_product
INNER JOIN
lew_category ON lew_category.id_category = lew_category_product.id_category
WHERE
@twesolowski
twesolowski / global.tpl
Created July 21, 2016 13:41
Prestashop bootstrap current screen
{if $smarty.const._PS_MODE_DEV_}
<div class="navbar-fixed-bottom">
<button type="button" class="btn btn-info">
<span class="device-xs visible-xs">xs</span>
<span class="device-sm visible-sm">sm</span>
<span class="device-md visible-md">md</span>
<span class="device-lg visible-lg">lg</span>
</button>
</div>
{/if}
@twesolowski
twesolowski / Rebuild_Icon_Cache.bat
Created July 15, 2016 06:28
Rebuild Icon Cache Windows
:: Created by: Shawn Brink
:: http://www.sevenforums.com
:: Tutorial: http://www.sevenforums.com/tutorials/49819-icon-cache-rebuild.html
@echo off
set iconcache=%localappdata%\IconCache.db
echo The Explorer process must be killed to delete the Icon DB.
echo.
echo Please SAVE ALL OPEN WORK before continuing.
@twesolowski
twesolowski / img_regenerate.php
Last active January 31, 2025 20:45
Prestashop - regenerate thumbnails - command line tool
<?php
/*
** img_regenerate.php products small
*/
define('_PS_ADMIN_DIR_', getcwd());
require_once(dirname(__FILE__).'/config/config.inc.php');
$types=array("categories", "manufacturers", "suppliers", "scenes", "products", "stores");
$deleteOldImages = true;
@twesolowski
twesolowski / img_rename.php
Last active October 3, 2016 08:18
Prestashop - mve images
<?php
include dirname(__FILE__) . '/config/config.inc.php';
// find img/p -maxdepth 1 -not -type d | php img_rename.php
$shortopts = "";
$longopts = array(
"dry"
);
$options = getopt($shortopts, $longopts);
@twesolowski
twesolowski / media-queries-based-on-bootstrap.less
Last active June 15, 2016 10:14 — forked from Mao8a/media-queries-based-on-bootstrap.less
LESS: MediaQueries based on bootstrap 3
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
$screen-xs: 480px !default;
$screen-phone: $screen-xs !default;
// Small screen / tablet
$screen-sm: 768px !default;
$screen-tablet: $screen-sm !default;