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
class TicketsController < ApplicationController | |
def index | |
@create_ticket = Ticket.new | |
@new_tickets = Ticket.where("state='new'"); | |
@current_tickets = Ticket.where("state='current'"); | |
@completed_tickets = Ticket.where("state='completed'"); | |
end | |
def show |
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
# I have the following two tables and I want to find both the growls and the regrowls sorted by the created_at for growls BUT also the created_at for regrowls. | |
create_table "regrowls", :force => true do |t| | |
t.integer "user_id" | |
t.integer "growl_id" | |
t.datetime "created_at", :null => false | |
t.datetime "updated_at", :null => false | |
end | |
create_table "growls", :force => true do |t| |
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
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[0;36m\]" | |
PINK="\[\033[0;35m\]" | |
WHITE="\[\033[1;37m\]" | |
BLACK="\[\033[0;30m\]" | |
OFF="\[\033[0m\]" |
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
class App extends Spine.Controller | |
constructor: -> | |
super | |
new Spine.SubStack | |
Spine.Route.setup() | |
@append(@rooms = new App.Rooms) | |
@append(@messages = new App.Messages) |
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
require 'resque' | |
if Rails.env.production? | |
redis_url = ENV["REDISTOGO_URL"] | |
uri = URI.parse(redis_url) | |
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
else | |
REDIS = Redis.new | |
end | |
Resque.redis = REDIS | |
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection } |
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
require 'resque' | |
if Rails.env.production? | |
redis_url = ENV["REDISTOGO_URL"] | |
uri = URI.parse(redis_url) | |
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
else | |
REDIS = Redis.new | |
end | |
Resque.redis = REDIS | |
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection } |
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
require 'resque/tasks' | |
ENV["QUEUE"] = "*" | |
task "resque:setup" => :environment | |
task "jobs:work" => "resque:work" |
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
def create | |
score1 = Score.new(:points => params[:score1], :player_id => params[:player1_id]) | |
score2 = Score.new(:points => params[:score2], :player_id => params[:player2_id]) | |
game = Game.new(params[:game], scores: [score1, score2]) | |
redirect_to games_path, notice: "Game results recorded!" if game.save | |
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
heroku ps:scale worker=1 |
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
heroku ps:scale worker=1 |