Skip to content

Instantly share code, notes, and snippets.

View dharma017's full-sized avatar

Dharma R. Thapa dharma017

  • Melbourne, Australia
View GitHub Profile
@dharma017
dharma017 / pixi-graphics-examples.js
Last active January 6, 2016 06:48 — forked from diverted247/gist:9216242
PIXI.js graphics examples
createjs.Graphics.prototype.dashedLineTo = function( x1 , y1 , x2 , y2 , dashLen ){
this.moveTo( x1 , y1 );
var dX = x2 - x1;
var dY = y2 - y1;
var dashes = Math.floor(Math.sqrt( dX * dX + dY * dY ) / dashLen );
var dashX = dX / dashes;
var dashY = dY / dashes;
var q = 0;
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by

New computer setup


Format the drive

  1. Restart with cmd-R or cmd-D
  2. Erase drive / 3x if second-hand
  3. Reinstall MacOS
@dharma017
dharma017 / searchwp_custom_fields.php
Last active January 6, 2016 06:46 — forked from jchristopher/gist:7880328
Search wordpress custom fields
<?php
// in this case we have three ACF Relationship fields set up, they have the names
// acf_rel_1, acf_rel_2, and acf_rel_3 (NOTE: these are the NAMES not the labels)
// ACF stores post IDs in one form or another, so indexing them does us no good,
// we want to index the title of the related post, so we need to extract it
function my_searchwp_custom_fields( $customFieldValue, $customFieldName, $thePost ) {
// by default we're just going to send the original value back
<?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 #