Skip to content

Instantly share code, notes, and snippets.

View ekka21's full-sized avatar

Ekkachai Danwanichakul ekka21

View GitHub Profile
@ekka21
ekka21 / disable-plugins-when-doing-local-dev.php
Created August 30, 2012 14:28 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@ekka21
ekka21 / gist:3708136
Created September 12, 2012 17:02
Wordpress: pagination pagenavi
<!-- Start Additional Resoruce Loop -->
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'additionalresource',
'posts_per_page' => 10,
'paged' => $paged,
'orderby' => 'date',
);
$the_query = new WP_Query( $args );
@ekka21
ekka21 / gist:3709235
Created September 12, 2012 19:19
Wordpress: wysiwyg editor
//Ref: http://codex.wordpress.org/Function_Reference/the_editor
//== how to add TinyMCE wysiwyg to your custom textarea plugin ==
the_editor($content, $id, $prev_id, $media_buttons, $tab_index, $extended);
@ekka21
ekka21 / gist:4333020
Last active December 9, 2015 21:48
Linux: gource
gource --user-image-dir .git/avatar/ --max-file-lag 3 --seconds-per-day 1 --hide filenames,mouse,progress -1024x768 -o - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre /usr/share/ffmpeg/libx264-lossless_slow.ffpreset -threads 0 gource.mp4
@ekka21
ekka21 / gist:4665225
Created January 29, 2013 15:47
Wordpress: remove wp logo on admin bar in the backend
function remove_wp_logo( $wp_admin_bar )
{
$wp_admin_bar->remove_node('wp-logo');
}
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );
@ekka21
ekka21 / gist:5886238
Created June 28, 2013 17:01
sass: mixin
@mixin debug
border: 1px solid red
@mixin hide-txt
overflow: hidden
text-indent: 1500%
white-space: nowrap
@mixin clearfix
&:before,
@ekka21
ekka21 / gist:5918840
Last active December 19, 2015 07:29
Pagoda: Boxfile
web1:
document_root: public
php_version: 5.3.10
php_extensions:
- mbstring
- mcrypt
- pdo_mysql
- mysql
- apc
- memcached
@ekka21
ekka21 / gist:5979014
Created July 11, 2013 20:36
Wordpress: add custom meta key to all of the post type
<?php
#domain.com/?run_script=1 to run this script
function add_my_custom_meta_key(){
global $wpdb;
if ($_GET['run_script'] =='1' && !is_admin() )
{
$q = 'SELECT id from wp_posts where post_type = "MY_CUSTOM_POST_TYPE"';
$ids = $wpdb->get_col($q);
foreach($ids as $id)
{
@ekka21
ekka21 / addhost
Last active August 29, 2015 14:10
Add a new /etc/hosts script
#!/bin/bash
echo "127.0.0.1 will be used if IP-Address is blank.";
read -p "IP-Address: " IP_ADDRESS
read -p "Site Name: " SITE_NAME
#Add a new /etc/hosts
if [ -n "$IP_ADDRESS" ]; then
#not empty
sudo -- sh -c "echo ${IP_ADDRESS} ${SITE_NAME} >> /etc/hosts"
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15