sudo curl -o /usr/local/bin/internet-off \
https://gist.githubusercontent.com/jfromaniello/9d2b0383feed978afdb4/raw/internet-off
sudo chmod +x /usr/local/bin/internet-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
var profiler = require('v8-profiler'); | |
process.on('SIGUSR2', () => { | |
const snapshot = profiler.takeSnapshot(); | |
const fileName = `/tmp/my-project-${Date.now()}.heapsnapshot`; | |
snapshot.export() | |
.pipe(fs.createWriteStream(fileName)) | |
.on('finish', () => { | |
console.log(`snapshot ${fileName} has been stored`); | |
snapshot.delete(); |
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
//lets say you want to find the property on the `resp` object | |
//that contains the url of the request | |
request.get('http://example.com/foo/bar', (err, resp, body) => { | |
console.dir(findMatchingProperty(resp, v => typeof v === 'string' && v.match(/\/foo\/bar/))); | |
}); | |
/** | |
The result is: |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "ctrl+left", | |
"command": "subwordNavigation.cursorSubwordLeft", | |
"when": "editorTextFocus" | |
}, | |
{ | |
"key": "ctrl+right", | |
"command": "subwordNavigation.cursorSubwordRight", |
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
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys | |
if (!Object.keys) { | |
Object.keys = (function() { | |
'use strict'; | |
var hasOwnProperty = Object.prototype.hasOwnProperty, | |
hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), | |
dontEnums = [ | |
'toString', | |
'toLocaleString', | |
'valueOf', |
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
# Description: | |
# Show an image of a sad panda everytime someone use `@channel` to notify every user on a channel. | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
This is a fork from the original CoreOS cloud formation template. It adds two EBS disks of 30G, mounted to /var/lib/docker.
This is intended to be used with an m3.large machine which comes with 30G of SSD.
The reason I add two of 30 and not one of 60 is because a BTRFS limitation.
You can use the "btrfs add" approach in the units to create a BTRFS raid.
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
#!/usr/bin/env bash | |
set -e | |
PHANTOM_FILE=phantomjs-1.9.7-linux-x86_64 | |
cd /usr/local/share | |
curl -Lo $PHANTOM_FILE.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_FILE.tar.bz2 |
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
test |
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 foo = { | |
a: { | |
b: { | |
c: 456 | |
} | |
} | |
}; | |
function getProp(obj, path) { | |
return path.split('.').reduce(function (prev, curr) { |
NewerOlder