This document seeks to summarize recent discussions about postmortem debugging, promises, and using them together. It starts by presenting what post-mortem debugging use cases are impacted negatively by the usage of promises. Then it describes some potential solutions that have been tried to fix these issues and their shortcomings.
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
function func(a, f) { | |
return function (args) { | |
args.__proto__ = a; | |
f.call(this, args); | |
}; | |
}; | |
var f = func({foo : 10, bar : 20}, function (args) { | |
print(args.foo, args.bar); |
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
// pre-ES5 IE version | |
var dict = (function() { | |
var PROPERTY_KEYS = [ | |
"hasOwnProperty", | |
"isPrototypeOf", | |
"propertyIsEnumerable" | |
"valueOf", | |
"toString", | |
"toLocaleString", | |
"constructor" |
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
# Save this file to ~/.multirust/Makefile | |
# to run, cd ~/.multirust; make toolchains/1.3.0/src | |
.PHONY: clean | |
rust.git: | |
git clone https://github.com/rust-lang/rust.git --bare | |
toolchains/nightly/src: toolchains/master/src | |
ln -sf $$(pwd)/toolchains/master/src $$(pwd)/$@ |
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 _log = console.log; | |
window.console.log = function(log){ | |
_log.call(console, log.reverse ? log.reverse() : typeof log === 'string' ? log.split('').reverse().join('') : typeof log === 'number' ? log.toString().split('').reverse().join('') : typeof log === 'boolean' ? !log : log); | |
}; |
async/await
is a new feature of the EcmaScript programming language that
combines generators and promises to improve the language-level model for
writing asynchronous code.
It is currently in "stage 3" of the TC39 process, which means it's a "candidate" that needs more implementation experience.
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
const msg = 'This is a great message'; | |
msg.replace('great', 'wonderful'); | |
// "This is a wonderful message" | |
// | |
// -> 'great' is replaced by 'wonderful' | |
msg.replace('great', '$&-$&'); | |
// "This is a great-great message" | |
// '$&' represents the matched substring |
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
### | |
Module dependencies | |
### | |
require.paths.unshift "#{__dirname}/lib/support/express-csrf/" | |
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/" | |
express = require 'express' | |
app = module.exports = express.createServer() | |
RedisStore = require 'connect-redis' |
Hacky script to send a bunch of logs to splunk directly
Currently, we don't have a tool that can send
- a specific set of logs
- with the right shape
- to a tenant
- in any environment
We have a bunch of separate tools that do different parts of this. We need a way to consolidate this functionality into fox-cli.
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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const url = new URL(request.url) | |
url.hostname = 'SOME_HOSTNAME' // i.e. 'dev-w-47n-vy-cd-e88kLg26GFbLGgBI.edge.tenants.auth0.com' | |
request = new Request(request) | |
request.headers.set('cname-api-key', 'SOME_KEY') // i.e. 'd4f2f3ef5a3ee3af4846127281d3450628bdc16d63e802dea75878fe9a63a279' | |
OlderNewer