Simple countdown using Greensock. You could add an "onComplete" to the Tweenlite to trigger an event when the countdown ends.
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 Benchmark = require('benchmark'); | |
var suite = new Benchmark.Suite, | |
a, b; | |
suite | |
.add('push', function () { | |
a = []; | |
for (var i = 0; i < 100; i++) | |
a.push('Text\n'); |
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 Benchmark = require('benchmark'), | |
jade = require('../'), | |
fs = require('fs'); | |
// Test cases | |
var cases = fs.readdirSync('cases').filter(function(file){ | |
return ~file.indexOf('.jade'); | |
}), | |
pretty = {}, |
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 pg = require('pg'), | |
path = require('path'), | |
Query = require(path.join(path.dirname(require.resolve('pg')), 'query')); | |
pg.Client.prototype.next = function (config, values, callback) { | |
//can take in strings or config objects | |
config = (typeof(config) == 'string') ? { text: config } : config; | |
if (this.binary && !('binary' in config)) { | |
config.binary = true; | |
} |
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 pg = require('pg'); | |
var client = new pg.Client('pg://user:pass@127.0.0.1/postgres'); | |
client.connect(function () { | |
client.query('CREATE TEMP TABLE foo (bar real)', function () { | |
for (var i = 0; i < 5; i++) | |
insertRandomNumber(); | |
}); | |
client.once('drain', function () { | |
client.query('SELECT bar FROM foo', function (err, results) { |
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 stylus1 = require('../node_modules/stylus'), | |
stylus2 = require('../cloned/stylus'), | |
Benchmark = require('benchmark'), | |
fs = require('fs'); | |
fs.readFile('C:/node/cloned/stylus/test/cases/regression.127.styl', 'utf8', function (err, str) { | |
if (err) throw err; | |
var handler = function (err, css) { | |
if (err) console.error(err); |
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 jade = require('jade'), | |
runtime = require('jade/lib/runtime'), | |
spawn = require('child_process').spawn, | |
fs = require('fs'); | |
function parse(str, filename){ | |
var options = {filename: filename, compileDebug: true}; | |
try { | |
// Parse | |
var parser = new jade.Parser(str, filename, options) |
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 fn = '\n var o={a: "Hello";\n b:"World"};' | |
var child = require('child_process').spawn(process.execPath, ['-e', fn]); | |
child.stderr.setEncoding('utf8'); | |
child.stderr.on('data', function (data) { | |
var errLines = data.split('\n'); | |
var infoLine = errLines[1].split(':'); | |
var descLine = errLines[4]; |
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
// http.FileSystem in-memory test stub | |
type TestOpener interface { | |
OpenAs(name string) http.File | |
} | |
type TestFileSystem TestDir | |
func (fs TestFileSystem) Open(name string) (http.File, error) { |
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
package main | |
import ( | |
"crypto/md5" | |
"crypto/rand" | |
"crypto/sha1" | |
"crypto/sha256" | |
"crypto/sha512" | |
"testing" | |
) |