This file contains hidden or 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
;; This is in erlang_mode_config.el | |
(provide 'erlang_mode_config) | |
(add-to-list 'load-path "/opt/lib/erlang/lib/tools-2.6.1/emacs") | |
(require 'erlang-start) | |
(setq erlang-indent-level 2) | |
(add-to-list 'exec-path "/opt/bin") | |
(setq erlang-root-dir "/opt") | |
This file contains hidden or 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
;;; | |
;;; This part is in ~/.emacs.local | |
;;; | |
;;; You can load it in your .emacs with this: | |
;;; (load "~/.emacs.local" t) | |
;; Erlang | |
(add-to-list 'load-path "/usr/local/lib/erlang/lib/tools-2.6.1/emacs") | |
(setq erlang-root-dir "/usr/local/lib/erlang") | |
This file contains hidden or 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
Router.prepare do |r| | |
r.match("/something", | |
:user_agent => %r[(?:one|two|three)] | |
).to(:controller => "foo", :action => "bar") | |
r.match("/something/else", | |
:user_agent => %r[(?:four|five|six)] | |
).to(:controller => "foo", :action => "bar") | |
end |
This file contains hidden or 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
Router.prepare do |r| | |
r.match("/something", :user_agent => %r[some/complex/regexp/with/parentheses]).to(:browser => ":user_agent[1]") | |
end | |
Router.generate(:browser => "something") | |
# => I can't tell if something is a valid match | |
# from the original :user_agent regex | |
# since we have :browser => "something", and we know that :browser is :user_agent[1], we match "something" against the regex |
This file contains hidden or 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 | |
require 'net/http' | |
require 'uri' | |
require 'rubygems' | |
require 'json' | |
require 'pp' | |
url = 'http://www.apple.com/retail/iphone/feeds/3g_us_inv.json' | |
json = Net::HTTP.get_response(URI.parse(url)).body |