Skip to content

Instantly share code, notes, and snippets.

View bipinshashi's full-sized avatar

Bipen Sasi bipinshashi

  • Unity Technologies
  • San Francisco, CA
View GitHub Profile
#TABLE SCHEMA
Persons : personID, firstName, lastName
Addresses : addressId, streetAddress1, streetAddress2, state, city, zip, country, personId
PhoneNumbers : phoneNumberId, value, personId
#Display people and their phone numbers
SELECT persons.firstname, persons.lastname, phonenumbers.value
FROM persons LEFT JOIN phonenumbers on
persons.personId=phonenumbers.personId;
@bipinshashi
bipinshashi / code.rb
Last active June 1, 2016 17:43
CF_teeshirt
=begin
CodeFights expands their t-shirt selection so that there is one color corresponding to each level (Gray/Recruit, Green/Trainee, Blue/Soldier, Yellow/Warrior, Red/Captain, Black/Ninja).
At the beginning of each month CodeFights receives a shipment of n t-shirts. There will always be an equal number of each color. Each user can only choose between 2 different colors when ordering a t-shirt. At the end of each month CodeFights takes all received orders and sends t-shirts, but only if it is possible to grant all requests. This explains why the process sometimes takes longer than expected (just teasing ^_^).
Given n and the list of orders placed, determine if CodeFights has enough t-shirts to fulfill all orders (true) or must wait until the next month (false).
Example
For n = 6 and orders = [["Red", "Black"],["Red", "Black"]],
if Rubber::Util.has_asset_pipeline?
# load 'deploy/assets'
_cset :asset_env, "RAILS_GROUPS=assets"
_cset :assets_prefix, "assets"
_cset :assets_role, [:web]
_cset :normalize_asset_timestamps, false
before 'deploy:finalize_update', 'deploy:assets:symlink'
# This is a sample Capistrano config file for rubber
set :rails_env, Rubber.env
on :load do
set :application, rubber_env.app_name
set :runner, rubber_env.app_user
set :deploy_to, "/mnt/#{application}-#{Rubber.env}"
set :copy_exclude, [".git/*", ".bundle/*", "log/*", ".rvmrc", ".rbenv-version"]
set :assets_role, [:app]