Skip to content

Instantly share code, notes, and snippets.

View whereisciao's full-sized avatar

Steven Chau whereisciao

  • Maxwell
  • Seattle, WA
View GitHub Profile
@whereisciao
whereisciao / mongoid.rb
Created February 10, 2011 15:34 — forked from outoftime/observing.rb
Mongoid Observer using ActiveModel.
require "#{RAILS_ROOT}/lib/mongoid/lib/observing.rb"
# Initializer for Observers
User.observers = :user_observer
User.instantiate_observers
# The preferred syntax, similar to AR's setup
# Mongoid.configure do |config|
# config.observers = :user_observer
@whereisciao
whereisciao / KCSourceLink-Interview.mdown
Created October 19, 2011 13:26
KCSourceLink Startup Weekend Interview
@whereisciao
whereisciao / example.js
Created November 30, 2011 23:19
Return the GPS coordinates of a house.
var PASSENGERS = [
{
username: "achang88",
name: "Alex Chang",
house: "Kirkland House"
},
{
username: "afaux",
name: "Ainsley Faux",
house: "Adams House"
@whereisciao
whereisciao / views.html
Created June 28, 2012 15:46
Backbone Composite View Notes
<div class="foo">
{{view "views/user/user-badge" resource_id=user.id}}
<view data-id="123"></view>
</div>
<script type="text/javascript">
// Then we find the placeholders and replace those elements with the subview’s element which it automatically creates for itself. In essence, the code does this:
parentView.$('view').each(function () {
var id = this.getAttribute('data-id'),
@whereisciao
whereisciao / campaign.rb
Created October 30, 2012 16:09
Example script for Surveygizmo classes
class Campaign < Hashie::Mash
include SurveyConnection
def survey_id
fetch("survey_id")
end
def campaign_id
fetch("id")
end
@whereisciao
whereisciao / itsadate.rb
Created June 20, 2013 19:50
I was able to reproduce your issue. By the time the test example loads, the Sinatra Application has already loaded and is configured. It was only when I moved the application loading to after the environment is setup then did the intended configuration is loaded. An alternative is to set the ENV before the test is ran for example `RACK_ENV=produ…
require "rubygems"
require "icalendar"
require "date"
require "sinatra"
require 'erb'
configure :test do
puts "Calling test"
end
@whereisciao
whereisciao / gist:10403540
Created April 10, 2014 17:16
Define Array.duplicated
class Array
def duplicated
select { |e| self.count(e) > 1 }.uniq
end
end
@whereisciao
whereisciao / eventbrite-gem-code-examples.rb
Last active March 19, 2016 16:14
Example code for Eventbrite Gem
require 'eventbrite'
require 'pry'
# Authenticate the Client
eventbrite = Eventbrite::REST::Client.new(oauth_token:"OAUTH_TOKEN")
# Example calls to fetch events, attendees, and orders
events = eventbrite.user_owned_events("me")
events = eventbrite.user_owned_events("me", status:"all")
attendees = eventbrite.event_attendees(8416549125) # Uses the Event Id
@whereisciao
whereisciao / README.md
Created September 26, 2016 03:51
Steven's Pho Receipes

Two base Pho Beef Broth receipes were used, both were from Jaden, a receipe developer. There were two key changes: more water and spices. I doubled the water from 9 cups to 18 cups as my crockpot would not have fit 4 lbs of oxtail bones and 9 cups of water. After spliting the 4 lbs of oxtail into two pots, I decided to use one Old Man Que Huong Pho Bac Spice Seasoning(Amazon) per pot as the spices were inexpensive.

Normal cooking time is 2-3 hours. I left the pots for 10 hours as I was following the crockpot receipe.

Base Receipes