Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am westoque on github.
  • I am westoque (https://keybase.io/westoque) on keybase.
  • I have a public key whose fingerprint is D5EA 1B04 A98F E6E6 503B 8A24 6696 E9C5 BAAB 1458

To claim this, I am signing this object:

# Activate the gem you are reporting the issue against.
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'pg'
GEMFILE
system 'bundle'
end
var events = require('events');
function Dog() {
}
util.inherits(Dog, events.EventEmitter);
// This statement will override the current `prototype`, thus losing
// the methods from EventEmitter.
Dog.prototype = {
@westoque
westoque / gist:2381346
Created April 14, 2012 01:30
Pop the question
var Animal = function() {
EventEmitter.call(this);
};
util.inherits(Animal, EventEmitter);
////////////////////////////////////
// QUESTION AREA
////////////////////////////////////
@westoque
westoque / gist:1447016
Created December 8, 2011 13:39
black box controller spec
describe MessagesController do
describe "POST create" do
it "saves the message" do
lambda {
post :create, :message => { "text" => "a quick brown fox" }
}.should change(Message, :count).by(1)
end
end
end
@westoque
westoque / gist:1446995
Created December 8, 2011 13:32
white box controller spec
describe MessagesController do
describe "POST create" do
let(:message) { mock_model(Message).as_null_object }
before do
Message.stub(:new).and_return(message)
end
it "creates a new message" do
Message.should_receive(:new).
The image http://mywebsite.com/images/mypicture.jpg cannot be displayed, because it contains errors.
We couldn’t find that file to show.
def create_video_thumb_nails(event)
videopath = "#{RAILS_ROOT}/public#{event.video.url}"
tpath = "#{RAILS_ROOT}/public/videos/#{event.id}/original/thumbnail.jpg"
image_path = "/videos/#{event.id}/original/thumbnail.jpg"
system `ffmpeg -itsoffset -30 -i #{videopath} -y -vcodec mjpeg -vframes 1 -an -f rawvideo -s 140x100 #{tpath}`
return image_path
end