Skip to content

Instantly share code, notes, and snippets.

View dharma017's full-sized avatar

Dharma R. Thapa dharma017

  • Melbourne, Australia
View GitHub Profile
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@dharma017
dharma017 / wp-autopopulate-taxonomy.php
Last active January 6, 2016 06:45 — forked from brenna/wp-autopopulate-taxonomy
Wordpress auto populate taxonomy whenever a post is created or edited
function custom_tax_init(){
//set some options for our new custom taxonomy
$args = array(
'label' => __( 'My Custom Taxonomy' ),
'hierarchical' => true,
'capabilities' => array(
// allow anyone editing posts to assign terms
'assign_terms' => 'edit_posts',
/* but you probably don't want anyone
@dharma017
dharma017 / using-git.md
Last active January 6, 2016 06:42 — forked from hofmannsven/README.md
Using Git
@dharma017
dharma017 / .bash_profile
Last active August 29, 2015 14:26 — forked from JeffreyWay/.bash_profile
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@dharma017
dharma017 / .gitignore
Last active September 13, 2015 12:16 — forked from octocat/.gitignore
Some common global .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@dharma017
dharma017 / debug-wordpress.md
Created September 13, 2015 11:08
Debugging in Wordpress

##WP_DEBUG

// Turn on wp_debug
define('WP_DEBUG', true);

// Turn off wp_debug
define('WP_DEBUG', false);

When WP_DEBUG is enabled it will override the default error_reporting settings in your php.ini file and change it to display all PHP errors, notices and warnings. Displaying errors will show problems that will break your code. Notices and warnings will display problems with the code that may not break the site but do not following correct PHP guidelines.

@dharma017
dharma017 / svn-export-sh.md
Created September 13, 2015 11:13
Deploy project via SVN with bash script

Write a bash script in Unix server and save as foo.sh

#!/bin/bash
cd /var/svn/foo/branches/devbranch
svn update
svn export --force  /var/svn/foo/branches/devbranch /var/www/foo

Provide permission to .sh file.

@dharma017
dharma017 / get-acquainted-with-git.md
Created September 13, 2015 11:19
Get acquainted with Git

Get Acquainted With Git*

###Basic Commands git init Creates a new Git repository in the current directory. In addition, a directory named .git is added to the folder. This folder holds all the Git history and information for the repo. To get rid of the repo, just delete the .git folder

git status Show me the current status of the repository. Shows

@dharma017
dharma017 / tools-to-improve-frontend-performance.md
Created September 13, 2015 11:24
Tools to Improve Front-End Performance (follow on twitter @Guilh)
@dharma017
dharma017 / python-http-server.md
Created September 13, 2015 11:37
Python http server

python 2.x

python -m SimpleHTTPServer 1234

python 3.x

python -m http.server

python 3.x

python -m http.server 1234

python 3.x , bind the server to a static ip address