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
# encoding: utf-8 | |
# ripped from gem that's not compatible with our app | |
module ValidatesUrlFormatOf | |
IPv4_PART = /\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]/ # 0-255 | |
# First regexp doesn't work in Ruby 1.8 and second has a bug in 1.9.2: | |
# https://github.com/henrik/validates_url_format_of/issues/issue/4/#comment_760674 | |
ALNUM = "ä".match(/[[:alnum:]]/) ? /[[:alnum:]]/ : /[^\W_]/ |
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
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz | |
tar xzf ruby-1.9.2-p180.tar.gz | |
cd ruby-1.9.2-p180 | |
./configure | |
make | |
make install | |
make install-doc | |
gem update --system |
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
coffee> bar = 42 | |
42 | |
coffee> bar "anything" | |
TypeError: Property 'bar' of object #<Object> is not a function | |
at repl:2:5 | |
at Object.eval (/usr/local/lib/node_modules/coffee-script/lib/coffee-script.js:89:15) | |
at Interface.<anonymous> (/usr/local/lib/node_modules/coffee-script/lib/repl.js:39:28) | |
at Interface.emit (events.js:64:17) | |
at Interface._onLine (readline.js:153:10) | |
at Interface._line (readline.js:408:8) |
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
$ coffee --version | |
CoffeeScript version 1.1.1 | |
$ coffee | |
coffee> s = "foo"+"bar" | |
'foobar' | |
coffee> s = "foo"+ "bar" | |
'foobar' | |
coffee> s = "foo" +"bar" | |
'foobar' |
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_get :current, :format => "js" do | |
setup { @request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}" } | |
should respond_with(:success) | |
should set_cookie(:hidden_notices).to("#{notices(:permanent).id}") | |
should render_template('notices/current') | |
end |
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
# To filter by message type while viewing the Inbox | |
should have_db_index [:profile_id, :message_type, :published_at] | |
# To calculate nightly Twitter and Facebook stats | |
should have_db_index [:profile_id, :service, :message_type, :published_at] | |
# To count incoming messages for each keyword snapshot | |
should have_db_index [:messagable_type, :messagable_id, :published_at] | |
# To find messages within the profile pane | |
should have_db_index [:profile_id, :service, :username] |
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
$s = 'Foo Bar A100B/ A101B/ A120B/'; | |
$s =~ s/(?:Foo Bar)? ([^\/]*)\//Foo Bar $1, /g; | |
$s =~ s/, $//; | |
print $s; | |
# Foo Bar A100B, Foo Bar A101B, Foo Bar A120B |
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
<? | |
// Should be called with args like this: | |
// php facebook_api_client.php \ | |
// <api key> \ | |
// <application secret> \ | |
// <session key> \ | |
// <API method name> \ | |
// <json encoded parameters for API method call> | |
// |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Hippie expand. Groovy vans with tie-dyes. | |
;; Change the default hippie-expand order and add yasnippet to the front. | |
(setq hippie-expand-try-functions-list | |
'(yas/hippie-try-expand | |
try-expand-dabbrev | |
try-expand-dabbrev-all-buffers | |
try-expand-dabbrev-from-kill | |
try-complete-file-name |
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
# Change the window title of X terminals | |
case $TERM in | |
xterm*|rxvt|Eterm|eterm) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' | |
;; | |
screen) | |
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' | |
;; | |
esac |