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
// simple cache implementation provide a key that you're looking for and | |
// a function that will compute the value in case of a cache miss | |
async get (key, expensiveFn) { | |
let result = await storage.get(key) | |
if (result === undefined) { | |
result = await expensiveFn | |
await storage.save(result) | |
} | |
return result | |
} |
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
// | |
// This program reads a sourcemap from stdin | |
// and replaces the "mappings" property with | |
// human readable content. It writes the output | |
// to stdout. | |
// | |
// 1. install the dependencies: | |
// npm i concat-stream vlq | |
// | |
// 2. optional: install jq for pretty printing json |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>callee.arguments test</title> | |
</head> | |
<body> | |
<script src="https://rawgit.com/stacktracejs/stackframe/master/dist/stackframe.js"></script> | |
<script src="https://rawgit.com/stacktracejs/stack-generator/master/dist/stack-generator.js"></script> | |
<script> |
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
# Use 'C-a' as the prefix | |
unbind C-b | |
set-option -g prefix C-a | |
# Shell | |
set -g default-command /bin/zsh | |
set -g default-shell /bin/zsh | |
# I want to manage my own names with prefix-comma | |
set -g automatic-rename off |
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
// | |
// ANYTIME DATE/TIME PICKER | |
// ============= | |
// | |
// | |
// -- Essential styles -- | |
// These styles are the bare minimum to have a working date/time picker. | |
// These are copied and converted to stylus from | |
// https://github.com/bengourley/anytime/blob/master/anytime.css |
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 moment = require('moment') | |
, View = require('ventnor') | |
, months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] | |
, days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] | |
function DatePickerView() { | |
View.apply(this, arguments) | |
this.startYear = 1960 | |
this.endYear = 2030 | |
this.currentView = { month: 11, year: 2014 } |
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
async | |
backbone | |
brfs | |
browjadify | |
browserify | |
bunyan | |
bytes | |
cf-api | |
cf-auth-middleware | |
cf-auth-provider |
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 thesaurus = require('thesaurus') | |
var words = 'Short tutorial on how to write like Russell Brand:\n\n1. Write an article\n2. Replace every word with a synonym from thesaurus.com'.split(' ') | |
console.log(words.map(function (word) { | |
var synonyms = thesaurus(word) | |
if (!synonyms.length) return word | |
return synonyms[0] | |
}).join(' ')) |
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
/* global slate */ | |
slate.config('defaultToCurrentScreen', true) | |
slate.config('windowHintsShowIcons', true) | |
slate.config('windowHintsIgnoreHiddenWindows', false) | |
var hint = slate.operation('hint') | |
slate.bind('esc:ctrl', hint) | |
var fullScreen = slate.operation('push', { direction: 'top', style: 'bar-resize:screenSizeY' }) |
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
{ '2:3': | |
{ w: 2000 | |
, h: 3000 | |
, x1: 0 | |
, y1: 0 | |
, x2: 200 | |
, y2 300 | |
} | |
} |
NewerOlder