Rails 3.0 introduced support for routing constrained by subdomains.
A subdomain can be specified explicitly, like this:
match '/' => 'home#index', :constraints => { :subdomain => 'www' }
| // HELPER: #key_value | |
| // | |
| // Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}} | |
| // | |
| // Iterate over an object, setting 'key' and 'value' for each property in | |
| // the object. | |
| Handlebars.registerHelper("key_value", function(obj, fn) { | |
| var buffer = "", | |
| key; |
| ## Prepare ################################################################### | |
| # Remove RVM | |
| rvm implode | |
| # Ensure your homebrew is working properly and up to date | |
| brew doctor | |
| brew update | |
| ## Install ################################################################### |
| # Global restrictions configuration file. | |
| # Designed to be included in any server {} block.</p> | |
| location = /favicon.ico { | |
| log_not_found off; | |
| access_log off; | |
| } | |
| location = /robots.txt { | |
| allow all; | |
| log_not_found off; |
| <!-- Make sure to load the injectCSS() function when the body is loading --> | |
| <body onload="injectCSS();"> | |
| FUN | |
| </body> |
| # recursively delete original files after a git merge failure | |
| find . -name *.orig -delete |
| awk | |
| bunzip2 | |
| bzcat | |
| bzip2 | |
| cat | |
| chown | |
| cp | |
| curl | |
| cut | |
| date |
| #!/usr/bin/env ruby | |
| require 'xmlsimple' | |
| require 'active_support/inflector' | |
| require 'yaml' | |
| require 'json' | |
| require 'fileutils' | |
| require 'date' | |
| class Post |
| def pbcopy(str) | |
| IO.popen('pbcopy', 'r+') {|io| io.puts str } | |
| output.puts "-- Copy to clipboard --\n#{str}" | |
| end | |
| Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n| | |
| pbcopy _pry_.input_array[n ? n.to_i : -1] | |
| end | |
| Pry.config.commands.command "copy", "Copy to clipboard" do |str| |
| (function(d) { | |
| var dl = d.createElement('a'); | |
| dl.innerText = 'Download MP3'; | |
| dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1]; | |
| dl.download = d.querySelector('em').innerText+".mp3"; | |
| d.querySelector('.primary').appendChild(dl); | |
| dl.style.marginLeft = '10px'; | |
| dl.style.color = 'red'; | |
| dl.style.fontWeight = 700; | |
| })(document); |