Skip to content

Instantly share code, notes, and snippets.

View beatak's full-sized avatar
🍄
Mushroom

Takashi M beatak

🍄
Mushroom
  • San Francisco, CA
View GitHub Profile
@beatak
beatak / node-tty.js
Created October 9, 2015 22:36
how to receive stdin in node
var onend = function (val) {
console.log('hi');
if (val) {
console.log('received:');
console.log(val);
}
process.exit(0);
};
if (process.stdin.isTTY) {
var wrap_spawn = function (arg_spawn, cb_on_close) {
var child = spawn.apply(null, arg_spawn);
var stdout = [];
var stderr = [];
child.stdout.on('data', function (data) {
stdout.push(data.toString());
});
child.stderr.on('data', function (data) {
stderr.push(data.toString());
});
.divider { content: "===="; }
diff --git a/tests/regexplexer.js b/tests/regexplexer.js
index 6128c47..79c38ea 100644
--- a/tests/regexplexer.js
+++ b/tests/regexplexer.js
@@ -1019,3 +1019,20 @@ exports["test yytext state after unput"] = function() {
assert.equal(lexer.lex(), "NUMBER");
assert.equal(lexer.lex(), "EOF");
};
+
+exports["test CSS string"] = function() {
(function () {
var c = Date.now();
console.log('start: ' + c);
new Promise(
function (res, rej) {
setTimeout(function (){
console.log('1st fullfilled at ' + Date.now());
res(1);
}, 1000);
}
#!/bin/sh
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
[1421637772589] Processing "activity/etsy.new_activity_stream" 0 of 271
-----------------------------------------------------------------------
AMD result
Timed out: 0.333s
Loaded scripts: ["etsy_action_toolbox_amd.js", "etsy_favorite_button_amd.js", "circles_amd.js", "backbone_0_9_2_amd.js", "common/etsy_loggingparams_amd.js", "/tmpdir/etsyweb-assets3-7770916/activity/_modules/shop_feed_message.js", "underscore.js", "backbone.js", "d3.js", "jquery.js", "polyfil.js", "require.js", "<<< inline script: require.config({baseUrl: \"/tmpdir/etsyweb-assets3-7770916/\"})...>>>", "activity/etsy_new_activity_stream_amd.js"]
[1421637777666] Processing "add-to-circle" 1 of 271
---------------------------------------------------
AMD result
Timed out: 0.333s
{
"children": [],
"through": {
"_": {}
},
"type": {
"name": "global"
},
"astNode": {
"type": "Script",
@beatak
beatak / es5.js
Created December 24, 2014 20:28
shift-scope example
'use strict';
var program = 'var a = 42;';
var parser = require('shift-parser');
var scope = require('shift-scope');
var ast = parser.default(program);
var scopeTree = scope.default(ast);
@beatak
beatak / new_eslint_errors4.json
Last active August 29, 2015 14:08
with the updated ignore files, it finds 11,252 errors. real: 37.61, user: 36.03, sys: 0.89, memusg: peak=284272
{
"file": {
"activity/_modules/buyer-onboarding.js": [
{
"id": "wrap-iife",
"location": "1:0",
"message": "Move the invocation into the parens that contain the function."
},
{
"id": "no-use-before-define",