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
| before(function (done) { | |
| server.server(options, function (s, db, providers) { | |
| //clear db and add a test user - "testuser" | |
| db.user.remove({}, function () { | |
| db.notification.remove({}, function () { | |
| providers.provider1.insertBulk(item1, item2, item3], | |
| function (err, result) { | |
| providers.provider2.insert([item1, item2, item3] | |
| function (err, result) { | |
| providers.provider3.insert([item1, item2, item3] |
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 actions = [ | |
| function () { | |
| /* code for step 1 */ | |
| callback(); | |
| }, function () { | |
| /* code for step 2 */ | |
| callback(); | |
| }, function () { | |
| /* code for step 3 */ | |
| callback(); |
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 _ = require("underscore"); | |
| /** | |
| * First argument is the callback to call when all are done | |
| * all other callbacks are functions of the form | |
| * function (callback, ...) { } | |
| * and must call callback when they are done | |
| * the ... will be any additional parameters from the previous step as | |
| * the first parameter of all functions is partially applied to be the callback | |
| * on creation of sequence. |
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
| ar _ = require("underscore"), | |
| assert = require("assert"), | |
| synchelper = require("../js/synchelper.js"); | |
| describe("Sync helper", function () { | |
| it("should preserve the arguments", function (done) { | |
| synchelper.waitForAll( | |
| done, | |
| function (callback) { | |
| callback(1); |
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
| before(function (done) { | |
| server.server(options, function (s, db, providers) { | |
| synchelper.waitForAll( | |
| function () { | |
| s.listen(); | |
| done(); | |
| }, | |
| function (callback) { db.notification.remove({}, callback); }, | |
| function (callback) { providers.provider1.insertBulk([item1, item2, item3], callback); }, | |
| function (callback) { providers.provider2.insertBulk([item1, item2, item3], callback); }, |
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
| import calendar | |
| import sys | |
| def ConvertDays(days): | |
| year = 1980 | |
| while days > 365: | |
| if calendar.isleap(year): | |
| if days > 366: | |
| days -= 366 | |
| year += 1 |
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 NotAuthenticated = function () { | |
| this.name = "Not authenticated"; | |
| Error.call(this, "Not authenticated"); | |
| Error.captureStackTrace(this, arguments.callee); | |
| }; | |
| NotAuthenticated.prototype.__proto__ = Error.prototype; | |
| ... later on .... | |
| if (error instanceof NotAuthenticated) { |
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
| for F in `find . -executable`; do ./$F -r 4 > tmp.pov; povray +O$F.png +A0.5 +AM2 +W1600 +H1200 tmp.pov; done |
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 Inotify = require('inotify').Inotify; | |
| var inotify = new Inotify(); //persistent by default, new Inotify(false) //no persistent | |
| var data = {}; //used to correlate two events | |
| var callback = function(event) { | |
| var mask = event.mask; | |
| var type = mask & Inotify.IN_ISDIR ? 'directory ' : 'file '; | |
| event.name ? type += ' ' + event.name + ' ': ' '; |
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
| #!/bin/bash | |
| if ! [ -d ".git" ]; then | |
| echo "Script must be run from within a git repository" | |
| exit 1 | |
| fi | |
| if [ $# -ne 1 ]; then | |
| echo "Please specify a script to execute for each commit" | |
| echo "Script will recieve <repo_dir> <commit ref> as arguments" |