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
%lex | |
%% | |
\n+ return 'NEWLINE' | |
\s+ /* skip whitespace */ | |
"\"\"\""(.|\n)+"\"\"\"" return 'PYSTRING' | |
^"@"(\w+) return 'TAGS' | |
^"#".+ return 'COMMENT' | |
^"Feature:" return 'FEATURE' |
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
#!/bin/bash | |
gawk ' | |
BEGIN { | |
FS = "\t"; | |
} | |
$7 == 1 { | |
print $6 " " strftime("%Y%m%d", substr($15, 0, length($15) - 3)); | |
} | |
' $1 |
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
#!/usr/bin/env bats | |
@test "run pig" { | |
rm -rf /tmp/pigResults | |
pig -x local -f ~/Documents/MSCR/qa.pig > /dev/null &>2 | |
cat /tmp/pigResults/* | sort > /tmp/pigResults/sorted.log | |
run cat /tmp/pigResults/sorted.log | |
echo ${lines[0]} | |
[ "${lines[0]}" = "Jan 26, 2012 10:46:01 AM 199.207.253.101 39435076 29.990 - talkingpointsmemo.com 449c44c4a84bf Online Purchase 4773 - view media - - 16 2012-01-25T22:49:49.000000 - - TradeDesk hbcybqc fsr8jn2 711818%7Cbeach+terry+cover-up%7C1%7C29.99 - -" ] |
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 saveUser = function(callback) { | |
User.update({_id: this._id}, this, callback); | |
} | |
User.findOne = function(selector, callback) { | |
MongoHelper.findOne(selector, collectionName, function(err, result) { | |
if (err) return callback(err); | |
result.save = saveUser; | |
return callback(null, result); |
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
file=*.test.js | |
files=`find test/unit -name '$(file)' -type f -print0 | xargs -0 echo` | |
default: all | |
all: unit peanut | |
ci: unit-ci peanut-ci | |
unit: |
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 Datomic = module.exports = function(server, port, alias, name) { | |
root = blah | |
this.db_uri = blah | |
this.createDatabase = function(done) {...} | |
} |
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
module.exports = function() { | |
var cache = {} | |
var timeouts = {} | |
function replaceTimeout(key) { | |
clearTimeout(timeouts[key]) | |
timeouts[key] = setTimeout(function() { | |
delete cache[key] | |
}, 5000) | |
} |
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
function addMethod(obj, name, fn) { | |
var old = obj[name] | |
obj[name] = function() { | |
if (fn.length === arguments.length) | |
return fn.apply(this, arguments) | |
else if (typeof old == 'function') | |
return old.apply(this, arguments) | |
} | |
} |
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
function SecModel() { | |
var user = getCurrentUser() //server call to user | |
return { | |
allowEdit: function() { | |
return user == profile.user | |
} | |
} | |
} |
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
class Sorter | |
place = (domino) => | |
one_idx = @key_index[domino[0]] | |
sort: (dominoes) -> | |
@sorted_dominoes = [] | |
@key_index = (0 for i in [0..9]) |
OlderNewer