Skip to content

Instantly share code, notes, and snippets.

View kadamwhite's full-sized avatar

K Adam White kadamwhite

View GitHub Profile
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
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/
*/
@helen
helen / wp-chosen-tax-metabox.php
Last active April 24, 2022 02:25
Use Chosen for a replacement WordPress taxonomy metabox
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to
@lgrammel
lgrammel / index.html
Created March 3, 2012 02:51
Interactive Streamgraph D3
<!DOCTYPE html>
<html>
<head>
<title>Streamgraph</title>
<script type="text/javascript" src="https://raw.github.com/lgrammel/d3/master/d3.v2.js"></script>
<script type="text/javascript" src="stream_layers.js"></script>
<script type="text/javascript" src="stream-chart.js"></script>
</head>
<body>
<div id="chart">
@tbranyen
tbranyen / bad-idea.js
Last active October 1, 2015 12:48
Get all the argument names from a given function
// Get the argument names from a given function
Function.prototype.args = function() {
// First match everything inside the function argument parens
var args = this.toString().match(/function\s.*?\(([^)]*)\)/)[1];
// Split the arguments string into an array comma delimited
return args.split(", ").map(function(arg) {
// Ensure no inline comments are parsed and trim the whitespace
return arg.replace(/\/\*.*\*\//, "").trim();
}).filter(function(arg) {
@fjenett
fjenett / complex.pde
Created April 11, 2012 18:41
Using Paper.js inside Processing.js
// More complex example
// Adapted from the following Processing example:
// http://processing.org/learning/topics/follow3.html
var path, segSize, segments, segStart, withBlur = true;
void setup ()
{
size( 500, 300 );
➜ 1.8pre git:(1.8pre) grunt
Running "selector:src/selector.js" (selector) task
<WARN> Unable to read "src/sizzle/sizzle.js" file (Error code: ENOENT). Use --force to continue. </WARN>
Aborted due to warnings.
# This error is caused by not having submodules pulled. Can be worked around by manually pulling submodules:
> git submodule update --init
# Next error is Windows only
@bradt
bradt / wp-routes.php
Created May 18, 2012 16:06
WordPress Routes
<?php
function bt_register_routes( $routes ) {
foreach ( $routes as $route_name => $args ) {
bt_register_route( $route_name, $args );
}
}
function bt_register_route( $route_name, $args = array() ) {
$args = wp_parse_args( $args, array(
'query_var' => 'route_' . $route_name,
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
1. Site files in www/mynewsite
2. SQL dump (if needed) in database/backups/database_name.sql
3. CREATE DATABASE and GRANT PRIVILEGES statements for new DB name in database/init-custom.sql
4. nginx config at /config/nginx-config/sites/my.site.name.conf
5. nginx config should have a unique server name and point to the www/mynewsite directory
6. vagrant reload
7. edit hosts file to point 192.168.50.4 to my.site.name