Skip to content

Instantly share code, notes, and snippets.

Avatar

Michiel Sikkes michiels

View GitHub Profile
View blog_test_public_method_4.rb
def test_build_clones_the_repository
@builder.build
assert File.exists?(File.expand_path("builds/cool_rails_project/README")), "Expected builds/cool_rails_project/README to exist after git clone"
end
View blog_test_public_methods_7.rb
def test_build_creates_workspace_directories
@builder.stubs(:clone_repository)
@builder.build
assert File.exists?(File.expand_path("builds/cool_rails_project")), "Expected directory builds/cool_rails_project to exist."
end
View blog_test_private_methods_6.rb
def new(project_name, config)
@workspace = File.expand_path(File.join("builds", project_name))
@build_directory = File.join(@workspace, "build")
@git_url = config['git']
@repository = nil
end
def build
create_workspace
clone_repository
View blog_test_public_method_5.rb
def new(project_name, config)
@workspace = File.expand_path(File.join("builds", project_name))
@build_directory = File.join(@workspace, "build")
@git_url = config['git']
@repository = nil
end
def build
FileUtils.mkdir_p(@workspace)
View gist:2250723
@organization.attributes = params[:organization]
if @organization.shipping_address.changed?
@order.shipping_address_changed = true
end
@michiels
michiels / gist:2652507
Created May 10, 2012
config.php for EE
View gist:2652507
<?php
/**
* Require the Focus Lab, LLC Master Config file
*/
require $_SERVER['DOCUMENT_ROOT'] . '/../config/config.master.php';
/* End of file config.php */
/* Location: ./system/expressionengine/config/config.php */
@michiels
michiels / README.md
Created Jun 6, 2012
Testing translate3d animations with Test/Unit, Poltergeist, Capybara and PhantomJS
View README.md

Testing translate3d animations with Test/Unit, Poltergeist, Capybara and PhantomJS

I am working on a jQuery plugin and needed a way to "integration" test it to see if everything in the browser worked correctly. I wanted an automatic testing solution and have looked at QUnit and such but it seemed an even better way to actually test it with a fake browser.

This example contains the following:

  • A Rack app that loads up index.html and javascripts from the demo/ directory.
@michiels
michiels / survey.rb
Created Sep 11, 2012
Survey save sample
View survey.rb
class Survey
include ActiveModel::AttributeMethods
define_attribute_methods ['code', 'description']
attr_accessor :code, :description
def save
# Roept de API aan via Faraday en update de velden
connection.post do |req|
View ffmpeg_wrapper.rb
class FFMPEGWrapper
def duration_in_sections
command = IO.popen("ffmpeg -i #{uploaded_file} 2>&1 | awk '/Duration/ { print substr($2,0,length($2)-1) }'")
duration_output = command.read
matches = duration_output.match(/(\d{2}):(\d{2}):(\d{2}\.\d{1,2})\n/)
hours = matches[1].to_f
minutes = matches[2].to_f
seconds = matches[3].to_f
miliseconds = matches[4].to_f