This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var code = '#include <stdio.h>\n int main (void){printf("testing");char x; x = getchar();printf("READ: %c",x);return 0;}'; | |
var child = require('child_process'); | |
fs.writeFile('tmp.c',code,function(){ | |
console.log('Code written to disk'); | |
var args = ['-o', process.cwd() + '/run', process.cwd() + '/tmp.c']; | |
console.log(args.join(' ')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn; | |
var fs = require('fs'); | |
var os = require('os'); | |
exports.trimSouthEast = function(file, i){ | |
/* | |
* Trims the bottom and right edges | |
*/ | |
var origFile = process.cwd() + '/' + file; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On index.js | |
//Configure Body Parser | |
app.configure(function() { | |
app.use(express.cookieParser()) | |
app.use(express.session({ | |
key: "QAWdefrAQ", | |
secret: 'asfyvhq987ertvyweiurytsdfgadekjr4yhtfsdfgt9jfwe3ht987234yh' | |
})) | |
app.use(express.bodyParser()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var mongoose = require('mongoose'); | |
var app = module.exports = express.createServer(); | |
var QueryModel = require('../lib/models/query'); | |
// the base route is | |
// /db/queries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Title module | |
Contains all the stuff related to the title, | |
from autogenerating it to storing a different | |
one | |
### | |
define [ | |
'app' | |
# modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function symmetric(number) { | |
return parseInt((''+number).split('').reverse().join('')); | |
} | |
var i = 0; | |
while (true) { | |
if ((""+symmetric(i)).length === (""+i).length) { | |
if (symmetric(i*i) === (symmetric(Math.pow(symmetric(i), 2)))) | |
console.log(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the collection | |
Cages.Cages = Backbone.Collection.extend( | |
model: Cages.Cage | |
url: app.dataServer + 'cages.json?date=2013-04-07&fetch_relationships=true' | |
) | |
# shows a list of cages | |
Cages.Views.CagesList = Backbone.View.extend( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Truly the most ridiculous thing I could think of. | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("XML", "png", "devtools", "RCurl") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Some helper functions, lineFinder and makeTable | |
source_gist("818983") | |
source_gist("818986") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s $CORDOVAPROJECT/www $GRUNTPROJECT/dist |