Skip to content

Instantly share code, notes, and snippets.

View rmm5t's full-sized avatar
🌐
building itsy bitsy parts of the internet that grow

Ryan McGeary rmm5t

🌐
building itsy bitsy parts of the internet that grow
View GitHub Profile
# 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_]/
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
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)
$ coffee --version
CoffeeScript version 1.1.1
$ coffee
coffee> s = "foo"+"bar"
'foobar'
coffee> s = "foo"+ "bar"
'foobar'
coffee> s = "foo" +"bar"
'foobar'
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
# 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]
$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
<?
// 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>
//
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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
# 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