Skip to content

Instantly share code, notes, and snippets.

View twesolowski's full-sized avatar

Tom Woo twesolowski

View GitHub Profile
@twesolowski
twesolowski / WPSQL-terms_tax
Created November 15, 2013 08:19
WPSQL-terms_tax
SELECT * from wp_terms t
LEFT JOIN wp_term_taxonomy tt ON t.term_id=tt.term_id
SELECT object_id
FROM wp_term_relationships tr , wp_term_taxonomy tt
WHERE tt.term_taxonomy_id=tr.term_taxonomy_id AND tr.term_id=151
@twesolowski
twesolowski / CliCounter.php
Created December 19, 2013 17:23
CliCounter
<?php
class CliCounter{
static $text=null;
static $bs = "\x08";
static $loading = array("[\\]", "[|]","[/]", "[|]");
static $loader = false;
static $date = false;
@twesolowski
twesolowski / preg_match.php
Created December 20, 2013 13:19
preg_match php one-page tool with history
<?php
$subject = isset($_POST['subject']) ? $_POST['subject'] : null;
$pattern = isset($_POST['pattern']) ? $_POST['pattern'] : null;
$historyFile = "preg_match_history.html";
session_start();
if(!isset($_SESSION['lastPattern'])){
$_SESSION['lastPattern'] = null;
@twesolowski
twesolowski / _extends.php
Created December 20, 2013 17:04
Prestashop extends for IDEs
<?php
class Address extends AddressCore {}
class AddressFormat extends AddressFormatCore {}
class AdminTab extends AdminTabCore {}
class Alias extends AliasCore {}
class Attachment extends AttachmentCore {}
class Attribute extends AttributeCore {}
class AttributeGroup extends AttributeGroupCore {}
class Backup extends BackupCore {}
class Blowfish extends BlowfishCore {}
@twesolowski
twesolowski / gist:8295575
Last active January 2, 2016 11:19
mysql utf8
SET NAMES 'utf8';
SET CHARACTER SET 'utf8';
SET COLLATION_CONNECTION='utf8_general_ci';
SET CHARSET 'utf8';
SET COLLATION_DATABASE='utf8_general_ci';
SET COLLATION_SERVER='utf8_general_ci';
@twesolowski
twesolowski / index.html
Last active January 2, 2016 13:59
Empty document - html5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
@twesolowski
twesolowski / file_var_export.php
Created April 1, 2014 10:25
PHP quick dump to file
file_put_contents("file", var_export($query, true), FILE_APPEND);
@twesolowski
twesolowski / sources.list
Last active August 29, 2015 13:58
Debian sources.list
deb http://security.debian.org/ squeeze/updates main contrib
deb-src http://security.debian.org/ squeeze/updates main contrib
deb http://ftp.pl.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.pl.debian.org/debian/ squeeze main contrib non-free
#nginx
#deb http://packages.dotdeb.org squeeze all
#deb-src http://packages.dotdeb.org squeeze all
@twesolowski
twesolowski / list_thumbnail_sizes.php
Created April 4, 2014 17:55
Wordpress - get all defined thumbnail sizes
<?php
function list_thumbnail_sizes() {
global $_wp_additional_image_sizes;
$sizes = array();
$rSizes = array();
foreach (get_intermediate_image_sizes() as $s) {
$sizes[$s] = array(0, 0);
if (in_array($s, array('thumbnail', 'medium', 'large'))) {
$sizes[$s][0] = get_option($s . '_size_w');
$sizes[$s][1] = get_option($s . '_size_h');