Skip to content

Instantly share code, notes, and snippets.

View gist:994515
admin_store_root /refinery/store(.:format) {:controller=>"admin/store/orders", :action=>"index"}
admin_store_orders GET /refinery/store/orders(.:format) {:action=>"index", :controller=>"admin/store/orders"}
POST /refinery/store/orders(.:format) {:action=>"create", :controller=>"admin/store/orders"}
new_admin_store_order GET /refinery/store/orders/new(.:format) {:action=>"new", :controller=>"admin/store/orders"}
edit_admin_store_order GET /refinery/store/orders/:id/edit(.:format) {:action=>"edit", :controller=>"admin/store/orders"}
admin_store_order GET /refinery/store/orders/:id(.:format) {:action=>"show", :controller=>"admin/store/orders"}
PUT
View gist:994595
Alabaster::Application.routes.draw do
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
scope(:path => 'blog', :as => 'blog', :module => 'blog') do
root :to => 'comments#index'
resources :posts do
get 'uncategorized', :on => :collection
end
end
scope(:path => 'store', :as => 'store', :module => 'store') do
View gist:1008495
<!DOCTYPE html>
<html>
<head>
<title>Alabaster</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="wrapper" class="1-column-layout">
View gist:1120985
require "devape_survey/engine"
module DevapeSurvey
config.to_prepare do
ApplicationController.helper(SurveysHelper)
end
end
View gist:1150730
MAIN FORM
<%= form_for(@project) do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@project.errors.count, "error") %> prohibited this project from being saved:</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
View gist:1165297
#loop through tsv, add to array
f = File.open(input_file, "r")
f.each_with_index { |line, i|
name_index = ""
price_index = ""
if(i==0) then
headers = line.split("\t")
headers[2] = headers.last.strip
name_index = headers.index("Name")
price_index = headers.index("Price")
View gist:1165305
class Output <
Struct.new(:name, :price)
end
unless ARGV.length == 1
puts "Wrong number of Arguments"
puts "Usage: ruby #{File.basename(__FILE__)} InputFile.tsv > SortedOutputFile.tsv\n"
exit
end
View gist:1171726
1000.times do |i|
m = Member.create(:email=> i.to_s + "john@john.com", :password=>"foobar", :password_confirmation=>"foobar", :orientation_id=>Orientation.random.first.id, :gender_id=↷
m.isos << Iso.random.first
m.isos << Iso.random.first
end
View gist:1171757
class Output <
Struct.new(:name, :price)
end
unless ARGV.length == 1
puts "Wrong number of Arguments"
puts "Usage: ruby #{File.basename(__FILE__)} InputFile.tsv"
exit
end
View gist:1171759
class Output <
Struct.new(:name, :price)
end
unless ARGV.length == 1
puts "Wrong number of Arguments"
puts "Usage: ruby #{File.basename(__FILE__)} InputFile.tsv"
exit
end
You can’t perform that action at this time.