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 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 |
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 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| |
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.
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
<?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 */ |
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
@organization.attributes = params[:organization] | |
if @organization.shipping_address.changed? | |
@order.shipping_address_changed = true | |
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
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 |
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
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 |
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
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) |
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
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 |