autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
In response to all the responses to: | |
http://twitter.com/rtomayko/status/1155906157 | |
You should never do this in a source file included with your library, | |
app, or tests: | |
require 'rubygems' | |
The system I use to manage my $LOAD_PATH is not your library/app/tests |
/* | |
Gmail bookmarklet | |
rondevera.com | |
For quickly e-mailing the current page's URL (and the selected text, if any) | |
via Gmail. | |
Usage: | |
- Create a new item in your bookmark bar with the name "Gmail" (or just "Gm", | |
or your favorite Unicode character), and the code below as the location. |
ּ_בּ | |
בּ_בּ | |
טּ_טּ | |
כּ‗כּ | |
לּ_לּ | |
מּ_מּ | |
סּ_סּ | |
תּ_תּ | |
٩(×̯×)۶ | |
٩(̾●̮̮̃̾•̃̾)۶ |
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
/* How to select a range of children | |
* (Here, 3rd-7th children, inclusive): | |
*/ | |
ul li:nth-child(n+3):nth-child(-n+7) { | |
outline: 1px solid #0f0; | |
} |
# Add a spacer to the OS X Dock: | |
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; osascript -e 'tell app "Dock" to quit' |
/* | |
* Bookmarklet for viewing source in iPad Safari | |
*/ | |
javascript:(function(){ | |
var w = window.open('about:blank'), | |
s = w.document; | |
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=device-width" /></head><body></body></html>'); | |
s.close(); | |
// Idea from http://dbaron.org/log/20100424-any | |
jQuery.expr[':'].any = function(el, i, match) { | |
return jQuery.find.matches(match[3], [el]).length > 0; | |
}; | |
jQuery('body :any(div, form) p'); // Same as jQuery('body div p, body form p') | |
jQuery('div:any(.foo,.bar)'); // Same as jQuery('div.foo, div.bar') |
#!/usr/bin/env ruby -w | |
## Using ruby's standard OptionParser to get subcommand's in command line arguments | |
## Note you cannot do: opt.rb help command | |
## other options are commander, main, GLI, trollop... | |
# run it as | |
# ruby opt.rb --help | |
# ruby opt.rb foo --help | |
# ruby opt.rb foo -q | |
# etc |
(function() { | |
var ua = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3'; | |
if (navigator.userAgent.indexOf(ua) === 0) { | |
document.write('<sc' + 'ript src="/js/ios3_bug.js"></sc' + 'ript>'); | |
} | |
})(); | |
// iPhone OS 3 requires an external script tag to be synchronously | |
// loaded in the HEAD od the HTML document if there's a reference |