Using:
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
#!/usr/bin/env node | |
var stdin = process.openStdin() | |
var data = '' | |
stdin | |
.on('data', function(chunk) { | |
data += chunk | |
}) | |
.on('end', function(){ | |
parse(data) |
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
this.myMethod(callback.bind(this)) | |
// vs. | |
this.myMethod(callback, this) | |
// In the former, context is in the hands of the user. In the latter, the context is the responsibility of the owner of `myMethod`. Every method in that API that accepts a callback now requires a bunch of boilerplate, e.g.: | |
myMethod: function (callback, ctx) { | |
ctx = (ctx || null) |
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
// Requires underscore.js and jquery.js | |
$.ajax({ | |
type: 'GET', | |
url: 'http://your-server.com/signature', | |
success: function(response){ | |
var data = new FormData(); | |
_.each(response.fields, function(val, key){ | |
data.append(key, val); | |
}); |
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(){ | |
chrome.tabs.getSelected(null, function(tab){ | |
var page = new Page(tab); | |
page.setScrollTo(100, 200, function(err, res){ | |
console.log('You just scrolled the page!'); | |
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
deploy: | |
rm -rf ./build | |
wintersmith build | |
cd ./build && \ | |
git init . && \ | |
git add . && \ | |
git commit -m "Deploy"; \ | |
git push "[email protected]:{YOUR NAME}/{YOUR REPO}.git" master:gh-pages --force && \ | |
rm -rf .git |
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(window, undefined){ | |
window.Document = Backbone.Model.extend({ | |
url: function () { | |
var self = this, | |
base = '/' + self.database; | |
if (self.isNew()) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<title>Google Maps JavaScript API v3 Example: Polygon Arrays</title> | |
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> | |
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> | |
<script type="text/javascript"> |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script> | |
$(function(){ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script> | |
<script type="text/javascript" src="https://raw.github.com/simplegeo/polymaps/master/polymaps.min.js"></script> | |
<style type="text/css"> | |
.link { stroke: #ccc; } | |
.nodetext { pointer-events: none; font: 10px sans-serif; } |