Skip to content

Instantly share code, notes, and snippets.

View kadamwhite's full-sized avatar

K Adam White kadamwhite

View GitHub Profile
@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) {
➜ 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
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
@moebio
moebio / gist:5601071
Last active December 17, 2015 11:19
list of references of my talk at http://openvisconf.com
@oconnore
oconnore / event_mixin.js
Created July 30, 2013 21:43
Backbone style events
(function(exports) {
'use strict';
/*
activecontexts is a two level map
Map(object -> Map(context -> true))
The second map is simply used for efficient set lookup (has)
*/
var activecontexts = new WeakMap();
@cowboy
cowboy / questions.json
Last active December 23, 2015 00:09
grunt-init y/n question helper.
[
{
"name": "yes",
"message": "This question will default to yes (true).",
"default": true
},
{
"name": "no",
"message": "This question will default to no (false).",
"default": false
int gap = 20;
void setup() {
size(1000, 1000);
strokeWeight(4);
strokeCap(SQUARE);
frameRate(0.5);
}
void draw() {
@mbostock
mbostock / .block
Last active September 21, 2016 16:15
Connected Particles III
license: gpl-3.0
<?php
/**
* Whitelist embedded links in the REST API responses
*
* This is often useful if you want to only get specified resources embedded along with the
* main resources, rather than the "all of nothing" approach of passing `?_embed` to the API request.
*
* You can either pass a comma seperated list of relationships or an array of string via the `_embed_include` query param.
*