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
// Generated by CoffeeScript 1.6.3 | |
var constraint, material, mesh, wheel_geometry; | |
material = Physijs.createMaterial(new THREE.MeshLambertMaterial({ | |
map: THREE.ImageUtils.loadTexture('images/checker.gif') | |
}), .8, .5); | |
wheel_geometry = new THREE.CylinderGeometry(5, 5, 2, 16); | |
mesh = new Physijs.CylinderMesh(wheel_geometry, material, 16); |
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
# credit @rwz | |
When /^I follow "([^"]+"(?: then "[^"]+")*)$/ do |links| | |
links.chomp(?").split('" then "').each do |link_text| | |
click_link link_text | |
end | |
end | |
# Example usage: | |
# When I follow "thing1" then "thing2" then "thing3" |
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 'mongoid' | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db('testing') | |
end | |
class User | |
include Mongoid::Document | |
collection.remove | |
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
class FuzzyHash | |
attr_reader :attrs | |
def initialize(attrs) | |
@attrs = attrs | |
end | |
def blank? | |
attrs.nil? | |
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 'spec_helper' | |
describe Candidate do | |
subject { Fabricate(:candidate, first_name: "Joe", last_name: "Doe") } | |
describe "#full_name" do | |
its(:full_name) { should == "Joe Doe" } | |
end | |
describe "#search" do |
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
NoMethodError: undefined method `read_nonblock' for #<OpenSSL::SSL::SSLSocket:0x44cdf872> | |
rbuf_fill at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/protocol.rb:135 | |
readuntil at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/protocol.rb:116 | |
readline at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/protocol.rb:126 | |
read_status_line at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/http.rb:2219 | |
read_new at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/http.rb:2208 | |
transport_request at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/http.rb:1191 | |
request at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/http.rb:1177 | |
request at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/http.rb:1170 | |
start at /Users/dev/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/net/http.rb:627 |
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
source 'http://rubygems.org' | |
gem 'rails', '3.1.1' | |
platforms :jruby do | |
gem 'jruby-openssl' | |
gem 'trinidad' | |
gem 'activerecord-jdbcpostgresql-adapter' | |
gem 'activerecord-jdbc-adapter' | |
gem 'jdbc-postgres', :require => false |
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
# http://stackoverflow.com/questions/1160741/how-to-save-a-base64-string-as-an-image-using-ruby | |
File.open('shipping_label.gif', 'wb') do|f| | |
f.write(Base64.decode64(base_64_encoded_data)) | |
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
(ns hackerfews.core | |
2 (:require [net.cgrand.enlive-html :as html])) | |
3 | |
4 (def url (java.net.URI. "http://news.ycombinator.com/")) | |
5 | |
6 (defn titles | |
7 [docx] (flatten (map :content (html/select docx [:td.title :a])))) | |
8 | |
9 (defn numbers-in-nodes | |
10 [docx selector] (let [x (flatten (map :content (html/select docx selector)))] |
OlderNewer