Skip to content

Instantly share code, notes, and snippets.

View phillipalexander's full-sized avatar

Phillip Alexander phillipalexander

  • Galvanize
  • San Francisco
View GitHub Profile
pairs = ( obj ) ->
arr = []
for own key, val of obj when key isnt "id"
arr.push "#{ key }=#{ val}"
arr.join ","
makeORMClass = ( table ) ->
# CoffeeScript syntactic sugar for class creation.
class Model
/* REPO UNWATCHER
*
* This unwatches any repo that you don't specify.
* It must be run from the console while you are at https://github.com/watching
*
* *No need to edit any code - the instructions will prompt you to list out the repos you'd like to keep watching!*
*/
var repo;
var repos = [];
@phillipalexander
phillipalexander / d3.phylogram.js
Created July 26, 2013 18:55 — forked from kueda/d3.phylogram.js
Demonstration of two common tree visualizations using [d3](http://mbostock.github.com/d3) and [newick.js](https://github.com/jasondavies/newick.js). I hadn't found any examples of these kinds of right-angle trees so I figured I'd share. Input data is a Newick-formatted guide tree from a clustalw multiple sequence alignment on some cytochrome b s…
/*
d3.phylogram.js
Wrapper around a d3-based phylogram (tree where branch lengths are scaled)
Also includes a radial dendrogram visualization (branch lengths not scaled)
along with some helper methods for building angled-branch trees.
d3.phylogram.build(selector, nodes, options)
Creates a phylogram.
Arguments:
selector: selector of an element that will contain the SVG
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
/*
Grep.js
Author : Nic da Costa ( @nic_daCosta )
Created : 2012/11/14
Version : 0.2
(c) Nic da Costa
License : MIT, GPL licenses
Overview:
Basic function that searches / filters any object or function and returns matched properties.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
#depends on underscore
_.isConstructor = (thing) ->
if thing.name && thing.name[0].toUpperCase() == thing.name[0]
true
else
false
class Instrumentor
constructor: (namespace) ->

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@phillipalexander
phillipalexander / uri.js
Created October 16, 2013 18:52 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"