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
| 'use strict'; | |
| var assert = require('assert'); | |
| var regex = /^(\/?(([^/*]+\/)*(\*\*(\/|$))?)?)?([^/*]*(\*([^*/]*))?)$/; | |
| regex.verify = function () { | |
| var success = [ | |
| '/foo/bar', | |
| '/foo/bar/', |
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
| 'use strict'; | |
| var fez = require('fez'); | |
| module.exports.default = function (rule, done) { | |
| setImmediate(function () { | |
| rule.each('src/*.js', fez.mapFile('dst/*.js'), function () {}); | |
| 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
| function makeOutputDir(inWC, outWC, dir) { | |
| if (outWC.indexOf('/**/') === -1) return outWC; | |
| var outMask = path.basename(outWC); | |
| inWC = path.dirname(inWC)+'/'; | |
| outWC = path.dirname(outWC)+'/'; | |
| dir = path.normalize(dir); | |
| var inSplit = inWC.split('/**/'), |
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 Promise = require('bluebird'); | |
| Promise.extend = function(method, fn) { | |
| var Promise = this; | |
| Promise.prototype[method] = function Promise$_Proxy() { | |
| var $_len = arguments.length; | |
| var args = new Array($_len + 1); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i + 1] = arguments[$_i];} | |
| var bound = this._isBound() ? this._boundTo : null; | |
| return this._then(function(obj) { |
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
| Setup: | |
| // (actually this is module.exports) | |
| var Prompt = new Blackbird(function (Promise) { | |
| function Prompt(opts, ctx) { | |
| this._opts = opts || { }; | |
| // copy over initialization variables | |
| ctx = ctx || { }; | |
| for (var key in ctx) { | |
| if (ctx.hasOwnProperty(key)) { |
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 circle(buffer, cx, cy, radius) { | |
| var error = -radius, | |
| x = radius, | |
| y = 0, | |
| lastY; | |
| while (x >= y) { | |
| lastY = y; | |
| error += y; |
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
| #include <v8.h> | |
| #include <node.h> | |
| #include <node_buffer.h> | |
| #include <node_version.h> | |
| #include <unistd.h> | |
| #include <string> | |
| #include <map> | |
| #include <exception> | |
| #include <exiv2/image.hpp> | |
| #include <exiv2/exif.hpp> |
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 api = require('socket.io') | |
| , io = null; | |
| var Message = require('./message') | |
| , User = require('./user'); | |
| var waitDelay = 1 | |
| , linePenalty = 2 | |
| , burstThreshold = 10 | |
| , numCharsPenalty = 120 |
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
| * In 'funcs.js': | |
| module.exports = { | |
| generatePseudoRandomToken: generatePseudoRandomToken, | |
| cookieWatcher: cookieWatcher | |
| }; | |
| function generatePseudoRandomToken() { | |
| require('crypto').randomBytes(48, function(ex, buf) { | |
| var token = buf.toString('hex'); | |
| }); |
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
| Friend.findOne({ | |
| userId: req.signedCookies.userid | |
| }, function (err, signedInUser) { | |
| var friends = signedInUser.friends.map( | |
| function (a) { return { user: a, type: 'friend' }; } | |
| ), | |
| sentRequests = signedInUser.request_sent_to.map( | |
| function (a) { return { user: a, type: 'sent' }; } | |
| ), |