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
## | |
# append a command to the bash history without executing it | |
# | |
# scenario: you've typed out a long command and realized you need to do | |
# something else before running it. ^a and prefix with "savecommand". | |
# | |
# usage: | |
# $ savecommand echo foo | |
# (do something else) | |
# $ !echo |
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
// add a log() method to all function objects | |
Function.prototype.log = function() { | |
var __method = this; | |
return function() { | |
var name = /function\s*(.*)\s*\(/.exec( __method ); | |
console.log( "called " + ( name[1] || "[unknown]" ) + "()", arguments ); | |
return __method.apply( null, arguments ); | |
} | |
} |
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
background-image: -moz-linear-gradient(rgba(255,255,255,0.05), rgba(255,255,255,0.2) 50%, rgba(0,0,0,0.01) 50%, rgba(0,0,0,0.05)); | |
background-image: -webkit-gradient( linear, left bottom, left top, from(rgba(0, 0, 0, 0.05)), color-stop(0.7, transparent)); |
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 stripansi="perl -ple 's/\033\[(?:\d*(?:;\d+)*)*m//g;'" | |
alias urlencode='perl -MURI::Escape -ne "\$/=\"\"; print uri_escape \$_"' | |
# use STDIN as the body of a new email in the default email client | |
# usage: git show head | mail | |
alias mail='open "mailto:?body=$(cat - | stripansi | urlencode)"' |
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
#$if Bash | |
"\e\e[C": forward-word | |
"\e\e[D": backward-word | |
#$endif | |
$include /etc/inputrc |
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
$.on( some_element, "mouseover", function( e ) { | |
setTimeout( function() { | |
// reference some property of e. throws a "member not found" exception in IE. | |
var mouseX = e.pageX || e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; | |
// ... | |
}, 1000 ); | |
} ); |
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
getMousePos = function( e ) { | |
return ( e.pageX || e.pageY ) ? { | |
x: e.pageX, | |
y: e.pageY | |
} : ( e.clientX || e.clientY ) ? { | |
x: e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft, | |
y: e.clientY + document.body.scrollTop + document.documentElement.scrollTop | |
} : null; | |
}, |
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
$ git rb explain publish | |
git_remote_branch version 0.3.0 | |
List of operations to do to publish an exiting local branch: | |
git push origin branch_to_publish:refs/heads/branch_to_publish | |
git fetch origin | |
git config branch.branch_to_publish.remote origin | |
git config branch.branch_to_publish.merge refs/heads/branch_to_publish | |
git checkout branch_to_publish |
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
$ cat /etc/avahi/services/device-info.service | |
<?xml version="1.0" standalone='no'?><!--*-nxml-*--> | |
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> | |
<!-- $Id: sftp-ssh.service 1294 2006-08-31 15:48:34Z lennart $ --> | |
<service-group> | |
<name replace-wildcards="yes">%h</name> | |
<service> | |
<type>_device-info._tcp</type> |
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
class Balls | |
def initialize() | |
@name = 'blah' | |
@caption = 'blah' | |
end | |
def to_hash | |
self.instance_variables.inject({}) do |a, e| | |
a[e[1..-1].to_sym] = self.instance_variable_get(e) |
OlderNewer