This file contains 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 'logger' | |
require 'rubygems' | |
require 'wirble' | |
require 'pp' | |
Wirble.init | |
Wirble.colorize | |
# require 'utility_belt' | |
if ENV.include?('RAILS_ENV')&& !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) |
This file contains 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 'test/unit' | |
require 'card' | |
require 'deck' | |
class CardTest < Test::Unit::TestCase | |
def setup | |
end | |
def test_a_five_is_greater_than_a_two | |
five_card = Card.new(5) |
This file contains 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
# you can turn two tests into one if you are testing almost the same thing | |
# example | |
before(:each) do | |
@project = Project.new | |
end | |
it "should contain errors on a blank url" do | |
@project.save | |
@project.errors.should include({:url=>["can't be blank"]}) | |
end |
This file contains 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
post '/irc/insert' do | |
puts '---' | |
puts "params #{params.inspect}" | |
puts "@conf #{@conf.inspect}" | |
puts '----' | |
if params[:login] && (params[:login][:key] == @conf[:key] && params[:login][:secret] == @conf[:secret]) | |
database[:log].insert( | |
params[:msg][:timestamp], | |
params[:msg][:nick], |
This file contains 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
FIELDS = %w[id first_name last_name headline industry current_status | |
current_status_timestamp summary specialties proposal_comments | |
associations honors interests api_standard_profile_request picture_url] | |
FIELDS.each do |f| | |
define_method(f.to_sym) do | |
@doc.xpath("//#{f.gsub(/_/,'-')}").text | |
end | |
end |
This file contains 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 'rubygems' | |
require 'linkedin' | |
require 'yaml' | |
# use your key to create a client object | |
client = LinkedIn::Client.new('your_consumer_key', 'your_consumer_secret') | |
# store the rtoken and rsecret | |
rtoken = client.request_token.token | |
rsecret = client.request_token.secret | |
# now we want to get permission for our application to use linkedin for our profile | |
client.request_token.authorize_url |
This file contains 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
{ | |
state: open | |
settings: { index.number_of_shards: 5index.number_of_replicas: 1index.version.created: 900299} | |
mappings: { | |
blogger: { | |
properties: { | |
mappings: { | |
properties: { | |
blogger: { | |
properties: { |