Skip to content

Instantly share code, notes, and snippets.

View connor's full-sized avatar

Connor Montgomery connor

View GitHub Profile
@connor
connor / shiftdifffunction.js
Created April 29, 2012 23:05
shift diff function
context.shiftDiff = function(diff) {
if (!arguments.length) shiftDiff = 20 // default
else shiftDiff = diff;
return update();
}
@connor
connor / shiftDiffInApi.js
Created April 29, 2012 23:05
example shiftdiff in API
var context = cubism.context()
.step(1e4)
.size(1440)
.shiftDiff(100); // shiftDiff is now 100
@connor
connor / afterPublicFunction.js
Created April 29, 2012 23:06
use shiftDiff var instead of numeric value
case 37: // left
if (d3.event.shiftKey && focus > shiftDiff) context.focus(focus -= shiftDiff);
else {
if (focus == null) focus = size - 1;
if (focus > 0) context.focus(--focus);
}
break;
case 39: // right
if (d3.event.shiftKey && size - focus > shiftDiff) context.focus(focus += shiftDiff);
else {
@connor
connor / beforeusingthenewapi.js
Created April 29, 2012 23:06
before using the API
var context = cubism.context()
.step(1e4)
.size(1440);
var context = cubism.context()
.step(1e4)
.size(1440)
.shiftDiff(200);
@connor
connor / app.js
Created May 9, 2012 02:16
github auth using everyauth
// Modules
var express = require('express')
, everyauth = require('everyauth')
, connect = require('connect');
var app = module.exports = express.createServer();
everyauth.debug = true
@connor
connor / dabblet.css
Created May 14, 2012 04:59
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(42deg, #f06, yellow);
min-height: 100%;
@connor
connor / package.json
Created May 28, 2012 04:57
Domai.nr node module package.json file
{
"name": "Domai.nr"
, "version": "1.0.0"
, "description": "A dead-simple way to utilize Domai.nr's JSON API"
, "keywords": [
"domainr"
, "domains"
, "search"
, "domain"
]
@connor
connor / domainr_example.js
Created May 28, 2012 05:28
How to use the domai.nr node module
var domainr = require("Domai.nr")
domainr.search("connor montgomery", function(responseFromDomainr) {
// do things with the responseFromDomainr object
})
domainr.info("cnnr.me", function(responseFromDomainr) {
@connor
connor / search1.js
Created May 28, 2012 05:32
search method wrapper
var request = require('request')
exports.search = function( query, callback ) {
// more code will go here
}