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 update | |
@bumblebee = if current_user.admin? | |
Bumblebee.find(params[:id]) | |
else | |
current_user.bumblebees.find_by(id: params[:id]) | |
end | |
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
ActiveRecord::RecordInvalid (Validation failed: Location has already been taken): | |
app/controllers/licensees_controller.rb:41:in `block (2 levels) in update' | |
app/controllers/licensees_controller.rb:38:in `update' |
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 'http' | |
require 'json' | |
$answer = [] | |
def extract_secret(id='start') | |
session_id = HTTP.get("http://challenge.shopcurbside.com/get-session").to_s | |
url = "http://challenge.shopcurbside.com/" | |
response = JSON.parse(HTTP.with_headers("Session" => session_id).get(url + id)) |
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
# Schema definitions for Whisper files. Entries are scanned in order, | |
# and first match wins. This file is scanned for changes every 60 seconds. | |
# | |
# [name] | |
# pattern = regex | |
# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ... | |
# Carbon's internal metrics. This entry should match what is specified in | |
# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings | |
[carbon] |
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
2.2.0 :045 > p = Player.joins(:team).select("players.name, upper(teams.abbreviation) as team_name").first | |
Player Load (0.4ms) SELECT players.name, upper(teams.abbreviation) as team_name FROM "players" INNER JOIN "teams" ON "teams"."id" = "players"."team_id" ORDER BY "players"."id" ASC LIMIT 1 | |
=> #<Player id: nil, name: "Kevin Garnett"> | |
2.2.0 :046 > p.attributes | |
=> {"name"=>"Kevin Garnett", "team_name"=>"BRO", "id"=>nil} | |
2.2.0 :047 > p = Player.eager_load(:team).select("players.name, upper(teams.abbreviation) as team_name").first | |
SQL (0.6ms) SELECT players.name, upper(teams.abbreviation) as team_name, "players"."id" AS t0_r0, "players"."first_name" AS t0_r1, "players"."last_name" AS t0_r2, "players"."active" AS t0_r3, "players"."created_at" AS t0_r4, "players"."updated_at" AS t0_r5, "players"."name" AS t0_r6, "players"."team_id" AS t0_r7, "teams"."id" AS t1_r0, "teams"."name" AS t1_r1, "teams"."abbreviation" AS t1_r2, "teams"."short_code" AS t1_r3, "teams"."conference" AS t1_r4, "teams"."division" |
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
2.1.0 :006 > Date.today | |
=> Sun, 21 Dec 2014 | |
2.1.0 :007 > Date.yesterday | |
=> Sun, 21 Dec 2014 | |
2.1.0 :008 > Date.tomorrow | |
=> Tue, 23 Dec 2014 |
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 'open-uri' | |
desc "Loads Game Data off of yahoo" | |
task :load_games => :environment do | |
start = Time.now | |
puts "Start: #{start}" | |
today = start.to_date | |
Player.all.each do |player| | |
games = {} | |
url = "http://sports.yahoo.com/nba/players/#{player.id}/gamelog/" | |
puts "Scraping #{url}" |
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
$('#resort_add_on_add_on_id').change (e) -> | |
$("#resort_add_on_add_on_id option:selected").each -> | |
description = $(this).data('description') | |
price = $(this).data('price') | |
pricing = $(this).data('pricing') | |
$("#resort_add_on_description").attr("placeholder", description) | |
$("#resort_add_on_price").attr("placeholder", price) | |
$("#resort_add_on_pricing").val(pricing) |
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
production: | |
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> |
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 Hand | |
require_relative 'deck' | |
def initialize | |
end | |
def new | |
end | |
def deal |