Skip to content

Instantly share code, notes, and snippets.

View johnbender's full-sized avatar

John Bender johnbender

View GitHub Profile
def solve
is_solution = @board.partial_solution?(Board.from_hash(params[:solution]))
if is_solution
current_user.current_user_game_board.score!
else
current_user.current_user_game_board.missed_guess!
end
current_user.next_board!
-- rcv.hs
import System.ZMQ as ZMQ
import Control.Monad
main = do context <- ZMQ.init 1
sock <- socket context Sub
subscribe sock ""
connect sock "tcp://localhost:5555"
forever $ do
import System.ZMQ as ZMQ
import Control.Monad
main = do context <- ZMQ.init 1
sock <- socket context Sub
subscribe sock ""
connect sock "tcp://localhost:5555"
forever $ do
str <- receive sock []
print str
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. For a detailed explanation
# and listing of configuration options, please check the documentation
# online.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "base"
# Enable chef
config.vm.provisioner = :chef_solo
before :all do
user = mock(Facebooker::User)
user.should_receive(:id).any_number_of_times.and_return(1)
friend = mock('friend')
friend.should_receive(:id).any_number_of_times.and_return(4800015)
user.should_receive(:friends).any_number_of_times.and_return([friend])
user.should_receive(:friends_with_this_app).any_number_of_times.and_return([friend])
ActiveRecord::SubclassNotFound Exception: The single-table inheritance mechanism failed to locate the subclass: 'DataSource::MySpace'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite DataSource.inheritance_column to use another column for that information.
class OAuthCredentialsController < ApplicationController
before_filter :source, :already_authed?
def new
#build initial request tokens
request_token, session[:unauthed_token] = @source.request_tokens
#TODO callback should be call_back_path from source id or some such
redirect_to @source.auth_url(request_token, "http://localhost:3000#{oauth_callback_path(@source.id)}")
end
class DataSource::MySpace < DataSource
#TODO move to parent OAuthDataSource class
def self.set_tokens(key, secret)
@@key = key
@@secret = secret
end
def request_tokens
#req token
class Foo < ActiveRecord::Base
end
class Bar < Foo
end