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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# Alias as `tagbydate = for-each-ref --sort=committerdate --format='%(refname:short)' refs/tags` | |
# `tagbydate- = for-each-ref --sort=-committerdate --format='%(refname:short)' refs/tags` | |
git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/tags |
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
/** | |
* jQuery method to test if any part of a given element is visible in the viewport. | |
* Source: http://upshots.org/javascript/jquery-test-if-element-is-in-viewport-visible-on-screen | |
**/ | |
$.fn.isOnScreen = function () { | |
var win = $(window); | |
var viewport = { | |
top: win.scrollTop(), |
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
# Strip the host and path information from the output. | |
tail -f /var/log/myservices.log | awk '/myproc/{ print substr($0, 82) }' |
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/sh | |
# this file should be marked as executable and placed on .git/hooks/ | |
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *') | |
if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ] && [ "$BRANCH_NAME" != "(nobranch)" ]; then | |
echo "#$BRANCH_NAME $(cat $1)" > $1 | |
fi |
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
# ~/.osx — http://mths.be/osx | |
# root check | |
if [[ $EUID -ne 0 ]]; then | |
echo "################################"; | |
echo "## YOU ARE NOT RUNNING AS ROOT #"; | |
echo "################################"; | |
echo "#"; | |
echo "# USAGE: sudo $0"; | |
exit; |
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
// Load the http module to create an http server. | |
var http = require('http'); | |
// Configure our HTTP server to respond with Hello World to all requests. | |
var server = http.createServer(function (request, response) { | |
response.writeHead(200, {"Content-Type": "text/plain"}); | |
response.end("Hello World\n"); | |
}); | |
// Listen on port 8000, IP defaults to 127.0.0.1 |
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
Show hidden characters
{ | |
"auto_complete": false, | |
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme", | |
"default_line_ending": "unix", | |
"ensure_newline_at_eof_on_save": true, | |
"find_selected_text": true, | |
"fold_buttons": true, | |
"font_options": | |
[ | |
"subpixel_antialias" |
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
namespace :jshint do | |
task :require do | |
sh "which jshint" do |ok, res| | |
fail 'Cannot find jshint on $PATH' unless ok | |
end | |
end | |
task :check => 'jshint:require' do | |
project_root = File.expand_path('../../', File.dirname(__FILE__)) | |
config_file = File.join(project_root, 'config', 'jshint.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
#!/usr/bin/env ruby -w | |
# brew-services(1) - Easily start and stop formulas via launchctl | |
# =============================================================== | |
# | |
# ## SYNOPSIS | |
# | |
# [<sudo>] `brew services` `list`<br> | |
# [<sudo>] `brew services` `restart` <formula><br> | |
# [<sudo>] `brew services` `start` <formula> [<plist>]<br> |