-
Doesn't output stdout or stderr of task commands automatically, so you have to do something like this:
{print} = require 'util' {spawn} = require 'child_process' task 'build', 'Build js/ from src/', -> coffee = spawn 'coffee', ['-c', '-o', 'js', 'src'] coffee.stderr.on 'data', (data) ->
This file contains 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
type git # get the type of any command. Great for | |
# seeing if a command exists. | |
ls -t # sort by time, newest first | |
ls -tr # sort by time, oldest first | |
grep -r "test" FILE_OR_DIR # recursive full text search | |
grep -i "test" FILE # case insensitive | |
grep -c "pattern" FILE # count | |
grep -n "pattern" # show line numbers |
This file contains 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
# importing | |
import sha # import the the sha module | |
from animal import Animal # import the Animal class from animal.py | |
# unit testing | |
# http://docs.python.org/3/library/unittest.html | |
import unittest | |
class AnimalTest(unittest.TestCase): |
This file contains 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
// change 0 to go to bol not hardbol (COMMAND MODE) | |
{ | |
"keys": ["0"], | |
"command": "move_to", | |
"args": { | |
"to": "bol" | |
}, | |
"context": [{ "key": "setting.command_mode", "operand": true }, { "key": "setting.is_widget", "operand": false }] | |
}, |
This file contains 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 formData = $('#myform').serializeArray(); | |
_.merge.apply(_, formData.map(function(o) { var kvp={}; kvp[o.name] = o.value; return kvp; })) |
This file contains 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
app.use(auth({ | |
clientID: 'FACEBOOK_APP_ID', | |
clientSecret: 'FACEBOOK_APP_SECRET', | |
sessionSecret: 'SESSION_SECRET', | |
userCollection: 'User', | |
callback: '/callback', | |
login: '/login', | |
// login: function(done) { | |
// auth.login({ | |
// role: req.query.role |
This file contains 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
[{ | |
"name": "Raine" | |
}, | |
{ | |
"name": "Chris" | |
}, | |
{ | |
"name": "Gene" | |
}] |
This file contains 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
// NOTE: The below is pseudo-code. You may need to make some adjustments to | |
// function signatures to use an asynchronous library like async.js | |
// these functions can be made truly asynchronous by accepting a callback | |
// this is preferrably to daisy chaining them, which is too tight a coupling | |
dv.get.gdp = function(cb) { | |
d3.csv('data/gdp.csv', function(error, data) { | |
dv.setup.massage(data, 'gdp'); | |
cb(error, data); | |
}); |