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 self.get_audio_length(filepath) | |
pipe = "ffmpeg -i "+ filepath.to_s+" 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//" | |
command = `#{pipe}` | |
if command =~ /([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/ | |
#convert the result to only secs | |
duration = ($2.to_i * 60) + $3.to_i | |
end | |
#return and array containing the seconds and the human readable time length, ["6453","03:54"] | |
return "#{duration.to_s},#{$2}:#{$3}".split(",") | |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-} | |
-- Stuff taken from the RSA module for now | |
module Primes where | |
import Data.Bits | |
import Data.Int | |
import Data.Word | |
import Data.ByteString.Lazy (ByteString) |
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
#!/bin/bash | |
#=============================================================================== | |
# | |
# FILE: getgeo.sh | |
# | |
# USAGE: ./getgeo.sh | |
# | |
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your | |
# database | |
# |
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
#/bin/bash | |
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password | |
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'` | |
if [ -z "$REPO_URL" ]; then | |
echo "-- ERROR: Could not identify Repo url." | |
echo " It is possible this repo is already using SSH instead of HTTPS." | |
exit | |
fi |
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
<div class="signes">{{Signes H}}</div> | |
<input type="button" value="Translittération" onclick="document.getElementById('transliteration').className += ' shown'; this.style.display = 'none'; return false;"> | |
<div id="transliteration" class="transliteration">{{Translittération}}</div> |
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
import java.sql.*; | |
import java.util.logging.*; | |
import javafx.application.Application; | |
import javafx.collections.*; | |
import javafx.event.ActionEvent; | |
import javafx.event.EventHandler; | |
import javafx.scene.Scene; | |
import javafx.scene.control.*; | |
import javafx.scene.layout.*; | |
import javafx.stage.Stage; |
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
= simple_form_for([:admin, @announcement]) do |f| | |
= f.error_notification | |
- current_profile = Profile.find_by_user_id(@current_user.id) | |
.form-inputs | |
= f.input :message, :required => true | |
= f.hidden_field :profile_id, :value => @current_user.primary_profile.id | |
= f.fields_for :TvScreen do |tv| | |
/// STARTS | |
= tv.input :starts_on, :placeholder => "MM/DD/YYYY", :input_html => {:class => "datepicker date-picker"}, :label => "Announcement starts on" |
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
#!/bin/bash | |
set -e -u | |
# Download and unzip data | |
wget http://download.geonames.org/export/dump/allCountries.zip | |
wget http://download.geonames.org/export/dump/alternateNames.zip | |
wget http://download.geonames.org/export/dump/countryInfo.txt | |
unzip allCountries.zip | |
unzip alternateNames.zip |
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
# Note that when compiling with coffeescript, the plugin is wrapped in another | |
# anonymous function. We do not need to pass in undefined as well, since | |
# coffeescript uses (void 0) instead. | |
do ($ = jQuery, window, document) -> | |
# window and document are passed through as local variable rather than global | |
# as this (slightly) quickens the resolution process and can be more efficiently | |
# minified (especially when both are regularly referenced in your plugin). | |
# Create the defaults once |
OlderNewer