Skip to content

Instantly share code, notes, and snippets.

var Q = require('q');
function hello() {
var d = Q.defer();
setTimeout(function() {
d.resolve('hello');
}, 1000);
return d.promise;
}
var http = require('http'),
fs = require('fs');
http.createServer(function (req, res) {
var user = 'paulfryzel';
var path = '/Users/' + user + '/Desktop/newapp/';
if (req.url === '/css/img/BG.png') {
fs.readFile(path + 'css/img/BG.png', function (error, content) {
if (error) {
res.writeHead(500);
var _scripts = [
'/vendor/javascripts/jquery.js',
'/vendor/javascripts/moment.js',
'/vendor/javascripts/mixpanel.js',
'/javascripts/main.js'
];
(function (scripts) {
'use strict';
function downloadJSAtOnload() {
# from: https://github.com/hashrocket/dotmatrix/blob/master/.hashrc
alias ll='ls -l'
# git_prompt_info accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
git_prompt_info () {
local g="$(git rev-parse --git-dir 2>/dev/null)"
if [ -n "$g" ]; then
local r
local b
".editorconfig
root = true
bundle/vim-jsbeautify/plugin/lib/beautify.js
[**.js]
; Path to the external file format
; The default is taken from the lib folder inside the folder extension.
path=~/.vim/bundle/vim-jsbeautify/plugin/lib/beautify.js
; Javascript interpreter to be invoked by default 'node'
bin=node
test('POST /photos', function (t) {
var payload = JSON.stringify(sample);
var route = { method: 'POST', url: '/photos', payload: payload};
server.inject(route, function (res) {
t.equal(200, res.statusCode, 'Should respond with 200');
t.ok(res.result, 'Should return a result');
sample._id = res.result.fields._id;
t.end();
});
});
@paulfryzel
paulfryzel / foo.js
Last active December 23, 2015 13:29
var parse = require('esprima').parse;
var generate = require('escodegen').generate;
function foo() {
var a = 1;
(function () {
var b = 2;
console.log(a);
})();
Concurrent recompilation has been disabled for tracing.
[marking 0x3e1853b6e1b1 <JS Function IsPrimitive (SharedFunctionInfo 0x3e1853b38c39)> for recompilation, reason: small function, ICs with typeinfo: 0/0 (100%)]
-----------------------------------------------------------
Compiling method IsPrimitive using hydrogen
[optimizing 0x3e1853b6e1b1 <JS Function IsPrimitive (SharedFunctionInfo 0x3e1853b38c39)> - took 0.026, 123.850, 8.967 ms]
[marking 0x3e1853b68f91 <JS Function Instantiate (SharedFunctionInfo 0x3e1853b39121)> for recompilation, reason: small function, ICs with typeinfo: 6/8 (75%)]
[marking 0x3db4d560e649 <JS Function valueOf (SharedFunctionInfo 0x3e1853b30899)> for recompilation, reason: small function, ICs with typeinfo: 1/1 (100%)]
[marking 0x3db4d560ce51 <JS Function toString (SharedFunctionInfo 0x3e1853b336f1)> for recompilation, reason: small function, ICs with typeinfo: 1/1 (100%)]
-----------------------------------------------------------
Compiling method valueOf using hydrogen
function Foo(obj) {
this.obj = obj;
this.time = Date.now();
}
function create() {
for (var i = 0; i < 1e6; i++) {
var f = new Foo({ foo: 42 });
}
}
// make objectprint=on disassembler=on -j4 ia32
// d8 --trace-hydrogen --print-opt-code --trace-phase=Z --trace-deopt --code-comments --emit-opt-code-positions --redirect-code-traces --redirect-code-traces-to=code.asm vector3.js
// d8 --prof vector3.js
// v8/tools/mac-tick-processor v8.log
// https://gist.github.com/trevnorris/7712539
// eager: Occurs with unexpected element transitions.
// lazy: Occurs when an assumption is made on a global which no longer holds true.
// soft: As v8 collects type information on functions it will mark dead subgraphs of the
// AST (abstract syntax tree). If one of those marked graphs is called this will cause the