By default RAILS_RELATIVE_URL_ROOT
is used only for asset pipeline.
To namespace your rails routes you need to wrap run MyApp::Application
with map
in your config.ru:
map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
require 'socket' | |
socket = TCPSocket.new('localhost', 7894) | |
socket.puts "'B'*50024" | |
all_data = [] | |
while partial_data = socket.read(2024) | |
puts partial_data | |
puts "-------------------------" | |
all_data << partial_data |
# Today's little useless tidbit converts a url's query string into a hash | |
# set of k/v pairs in a way that merges duplicates and massages empty | |
# querystring values | |
def qs_to_hash(querystring) | |
keyvals = query.split('&').inject({}) do |result, q| | |
k,v = q.split('=') | |
if !v.nil? | |
result.merge({k => v}) | |
elsif !result.key?(k) |
# Accepts a list and a key function to apply to each item, | |
# and then uses a decorate-sort-undecorate pattern to actually | |
# do the sorting. Returns a new list. Keeps track of the index | |
# to make sure the sort is stable. | |
sort_by = (list, key) -> | |
cmp = ({key: k_a, index: i_a}, {key: k_b, index: i_b}) -> | |
if k_a == k_b then i_a - i_b else if k_a < k_b then -1 else 1 | |
decorated = ({item, index, key: key item} for item, index in list) | |
item for {item} in decorated.sort cmp |
# active_admin and formtastic seem kinda picky about displaying both the | |
# image and the file input together here... in fact, it seems like this | |
# is the ONLY way to do this? Adding anything else after the image_tag squashes it. | |
ActiveAdmin.register Film do | |
form do |f| | |
f.inputs "Film" do | |
f.input :title | |
end | |
f.has_many :stills do |film_still_form| |
source "https://rubygems.org" | |
gem 'puma' | |
gem 'sinatra' |
`/** @jsx React.DOM */` | |
converter = new Showdown.converter | |
Comment = React.createClass | |
render: -> | |
rawMarkup = converter.makeHtml @props.children.toString() | |
`<div className="comment"> | |
<h2 className="comment">{this.props.author}</h2> | |
<span dangerouslySetInnerHTML={{__html: rawMarkup}} /> |
name: Pacific/Kiritimati , cc: KI , offset: 50400 (14 hours) , comments: Line Islands | |
name: Pacific/Chatham , cc: NZ , offset: 49500 (13.75 hours) , comments: Chatham Islands | |
name: Pacific/Fakaofo , cc: TK , offset: 46800 (13 hours) , comments: | |
name: Antarctica/South_Pole , cc: AQ , offset: 46800 (13 hours) , comments: Amundsen-Scott Station, South Pole | |
name: Antarctica/McMurdo , cc: AQ , offset: 46800 (13 hours) , comments: McMurdo Station, Ross Island | |
name: Pacific/Tongatapu , cc: TO , offset: 46800 (13 hours) , comments: | |
name: Pacific/Enderbury , cc: KI , offset: 46800 (13 hours) , comments: Phoenix Islands | |
name: Pacific/Apia , cc: WS , offset: 46800 (13 hours) , comments: |
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo 'Usage: git-branch-description <branch name>' >&2 | |
exit 1 | |
fi | |
EDITOR='cat' git branch --edit-description "$1" | grep -v '^#' |