Skip to content

Instantly share code, notes, and snippets.

View abloom's full-sized avatar

Andrew Bloom abloom

  • Turquoise Health
  • Chicago Il
View GitHub Profile
ActionController::Routing::Routes.draw do |map|
map.resources :fans
map.resources :league_players
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.login '/login', :controller => 'sessions', :action => 'new'
map.check '/check', :controller => 'sessions', :action => 'create'
#This is the form tag I normally have to do
<% #form_for game_player,:url => game_player_path(params[:slug], game_player) do |f| %>
#This is what I was trying
# This form submits to http://localhost:3000/game_players/update_all, I need the team slug in front
<% form_tag (:controller => "game_players", :action => "update_all") do %>
<% for game_player in @game_players %>
<% fields_for "game_player_#{game_player.id}" do |f| %>
<%= f.error_messages %>
class LinkBar
def initialize
@bars = Hash.new
end
def register(linkbar_name, links)
@bars[linkbar_name] ||= []
@bars[linkbar_name].concat links
end
ActionController::Routing::Routes.draw do |map|
map.resources :fans
map.resources :league_players
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.login '/login', :controller => 'sessions', :action => 'new'
map.check '/check', :controller => 'sessions', :action => 'create'
sudo su postgres -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
sudo sed -i -e 's/#client_min_messages = notice/client_min_messages = error/' /opt/local/var/db/postgresql84/defaultdb/postgresql.conf
sudo sed -i -e 's/#log_min_messages = warning/log_min_messages = error/' /opt/local/var/db/postgresql84/defaultdb/postgresql.conf
sudo /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper start
sudo su postgres -c '/opt/local/lib/postgresql84/bin/createuser -s mms'
sudo su postgres -c '/opt/local/lib/postgresql84/bin/createuser -s YOUR_USER_NAME'
/opt/local/lib/postgresql84/bin/createdb mms_development
/opt/local/lib/postgresql84/bin/createdb mms_test
module Frylock
attr_accessor :app
def config
@config ||= Frylock::Config.new(app || Rails)
end
end
@abloom
abloom / test.js
Created April 8, 2011 18:01 — forked from x1024/gist:794143
var http = require('http'),
should = require('should'),
io = require('socket.io'),
decode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').decode,
encode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').encode,
WebSocket = require('.npm/socket.io/0.6.8/package/support/node-websocket-client/lib/websocket.js').WebSocket;
exports['Socket.IO mocking'] = function(assert){
var _server = require('http').createServer(function(){});
// A mock client object.
{
"id": 6,
"name": "Campaign with RFPs and IOs",
"budget_cents": 11100000,
"start_date": "2013-04-29",
"end_date": "2014-02-21",
"client": {
"id": 6,
"name": "Kwik-E-Mart"
},
# shortest_string is a method that takes an array of strings as its input
# and returns the shortest string
# +array+ is an array of strings
# shortest_string(array) should return the shortest string in +array+
# If +array+ is empty the method should return nil
# array.sort.first
def shortest_string(array)
new_count = [ ]
def super_fizzbuzz(array)
fizzbuzzed = []
array.each do |num|
if num % 3 == 0 && num % 5 == 0 # return "FizzBuzz"
elseif num % 3 == 0 # return "Fizz"
elseif num % 5 == 0 # return "Buzz"
elseif num /
place
end