Skip to content

Instantly share code, notes, and snippets.

View michiels's full-sized avatar

Michiel Sikkes michiels

View GitHub Profile
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
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
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
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)
@organization.attributes = params[:organization]
if @organization.shipping_address.changed?
@order.shipping_address_changed = true
end
@michiels
michiels / gist:2652507
Created May 10, 2012 11:22
config.php for EE
<?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 June 6, 2012 20:20
Testing translate3d animations with Test/Unit, Poltergeist, Capybara and PhantomJS

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 / README.md
Created September 11, 2012 11:45
API Sample

Sample API

@michiels
michiels / survey.rb
Created September 11, 2012 13:13
Survey save sample
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|
@michiels
michiels / ffmpeg_wrapper.rb
Created November 14, 2012 14:19
FFMPEG Wrapper
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