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
// https://developer.mozilla.org/en-US/docs/Web/API/window.setTimeout | |
var timeoutID; | |
delayedAlert(); | |
function delayedAlert() { | |
timeoutID = window.setTimeout(slowAlert, 2000); | |
} | |
function slowAlert() { |
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
phantom = require('phantom') | |
if(!process.argv[2]) { | |
console.log('Usage: node app.js [url]') | |
process.exit(1) | |
} | |
var url = process.argv[2] | |
phantom.create(function(ph){ | |
ph.createPage(function(page) { |
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
{ | |
"scripts": { | |
"eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi" | |
}, | |
"devDependencies": { | |
"pre-commit": "0.0.7", | |
"eslint": "~0.5.1" | |
}, | |
"pre-commit": [ | |
"eslint" |
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
# Install http://pygments.org/download/ to use this improved cat! | |
cat() { | |
if command -v pygmentize > /dev/null; then | |
pygmentize $1 > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
pygmentize $1 | |
else | |
command cat $1 | |
fi | |
else |
Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
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
#!/bin/bash | |
# Functions ============================================== | |
# return 1 if global command line program installed, else 0 | |
# example | |
# echo "node: $(program_is_installed node)" | |
function program_is_installed { | |
# set to 1 initially | |
local return_=1 |
#Node - Processes
To launch an external shell command or executable file you can use the child_process
. Apart from command line arguments and environment variables you cannot communicate with the process using child_process.exec
. However you can use child_process.spawn
to create a more integrated processes.
##Executing Child Processes
###To launch an external shell command
var child_process = require('child_process');
var exec = child_process.exec;
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
box-shadow:inset 0 1px 0 rgba(255,255,255,.6), 0 22px 70px 4px rgba(0,0,0,0.56), 0 0 0 1px rgba(0, 0, 0, 0.3); |
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
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
# that enables you to choose a character from a menu of options. If you are on Lion | |
# try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
# for input. | |
# | |
# It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
# as it means you cannot press and hold h/j/k/l to move through your file. You have | |
# to repeatedly press the keys to navigate. |