Skip to content

Instantly share code, notes, and snippets.

View tanatip's full-sized avatar
🏠
Working from home

Tanatip Siriprathum tanatip

🏠
Working from home
View GitHub Profile
@ggendre
ggendre / gist:905833
Created April 6, 2011 15:16
javascript : convert a string to XML DOM
//this function convert the string representation of some XML
//into a DOM object.
function StringToXMLDom(string){
var xmlDoc=null;
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(string,"text/xml");
}
else // Internet Explorer
@Obsidion
Obsidion / gist:1204800
Created September 8, 2011 21:28
Create bare git repo
---------NO CODE YET--------
on server:
git init --bare
then clone it locally:
git clone git@server:/myNewRepo.git
@luetkemj
luetkemj / wp-query-ref.php
Last active April 6, 2025 09:15
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@bgallagh3r
bgallagh3r / wp.sh
Last active March 23, 2025 19:40
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@ChromeOrange
ChromeOrange / functions-columns.php
Created June 28, 2012 14:00
Change the product columns in WooCommerce
/*
1 - modify your theme functions file
2 - modify the 'loop-shop.php' file
You need to set the 'Product List' value to suit your layout. You will also need to look at changing the CSS if you change from the default WooCommerce values.
1 : Add this to your theme functions file
*/
add_filter('loop_shop_columns', 'wc_product_columns_frontend');
function wc_product_columns_frontend() {
global $woocommerce;
@dajoho
dajoho / phpcs
Created October 4, 2012 11:39
Install PHPCS OSX
sudo cp /private/etc/php.ini.default /private/etc/php.ini;
sudo php /usr/lib/php/install-pear-nozlib.phar;
pear config-set php_ini /private/etc/php.ini;
pecl config-set php_ini /private/etc/php.ini;
sudo pear upgrade-all;
sudo pear install PHP_CodeSniffer;
----
nano /private/etc/php.ini;
include_path Zeile einkommentieren & umändern in:
@claudiosanches
claudiosanches / category-image-field.php
Last active November 18, 2017 19:23
Adds image field in category description.
<?php
/*
* Plugin Name: Category Image Field
* Plugin URI: http://claudiosmweb.com/
* Description: Adds image field in category description.
* Version: 0.1
* Author: Claudio Sanches
* Author URI: http://claudiosmweb.com/
* License: GPLv2 or later
*/
@cosmocatalano
cosmocatalano / instagram_scrape.php
Last active February 8, 2025 07:43
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
<?php
/**
* My Project
*
* @package MyProject
* @subpackage JesGs_Walker_Category
* @author Jess Green <[email protected]>
* @version $Id$
*/
@tomess
tomess / gist:4692191
Created February 1, 2013 16:00
CSS: rem/px font-size-Tabelle
font-size:10px;
font-size:0.625rem;
font-size:11px;
font-size:0.6875rem;
font-size:12px;
font-size:0.75rem;
font-size:13px;