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 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 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 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 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 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 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 pg = require('pg'); | |
var client = new pg.Client('pg://user:[email protected]/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 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 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 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 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 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 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 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
/*! | |
* Jade | |
* Copyright(c) 2010 TJ Holowaychuk <[email protected]> | |
* MIT Licensed | |
*/ | |
/** | |
* Module dependencies. | |
*/ |
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
self = | |
{ | |
header: "Header", | |
header2: "Header2", | |
header3: "Header3", | |
header4: "Header4", | |
header5: "Header5", | |
header6: "Header6", | |
list: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] | |
}; |
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
void AlertIfError() { | |
DWORD dw = GetLastError(); | |
if (dw == ERROR_SUCCESS) { | |
return; | |
} | |
LPTSTR lpMsgBuf; | |
FormatMessage( | |
FORMAT_MESSAGE_ALLOCATE_BUFFER | |
OlderNewer