Skip to content

Instantly share code, notes, and snippets.

View ratbeard's full-sized avatar

Mike Frawley ratbeard

View GitHub Profile
Feature: Validating user input
In order to prevent shipping errors
Users input should be validated
@javascript
Scenario: Client-side form validation
Given I am on the form step
When I click "Submit"
Then I should see validation errors:
///////////////////////
// Image Pre- Loading
///////////////////////
// Use a timeout so failing to preload image doesn't stop the page from loading
// Can pass 'false' for timeout to never timeout
function loadImages (images, callback, timeout) {
var img, i, loaded = 0, total = images.length, called = false
//console.log('loading images', images.length, images)
if (timeout) setTimeout(callCallback, timeout)
@ratbeard
ratbeard / cool.rb
Last active December 17, 2015 04:29
class PageObject
def click
puts 'click'
end
def submit
puts 'submit'
end
def wait_for_ajax
# Install with:
# brew install ffmpeg --HEAD --with-freetype --with--ffplay
# http://www.ffmpeg.org/ffmpeg-filters.html#overlay
# Make a blank video
#ffmpeg -y -filter_complex "color=black:s=960x960:d=6" blank-960x960-6s.mp4
#ffmpeg -y -filter_complex "color=white:s=960x960:d=6" blank-white-960x960-6s.mp4
#
# Another way to make backgrounds
ffmpeg -y -re
-i /var/www/usp-evaluation/video/v1/deadfall.mp4
-movflags isml+frag_keyframe -f ismv -threads 0
-c:a libfaac -ac 2 -b:a 64k
-c:v libx264 -preset fast -profile:v baseline -g 48 -keyint_min 48 -sc_threshold 0
-map 0:v -b:v:0 2877k -s:v:0 1280x720
-map 0:v -b:v:1 1872k -s:v:1 720x404
-map 0:v -b:v:2 1231k -s:v:2 704x396
-map 0:v -b:v:3 830k -s:v:3 640x360
http://localhost/live/live.isml/Streams(video)
var getMapData = function( ) {
this.stateOutlines = {};
this.HRROutlines = {};
this.filterableData = {};
this.layersByHRRNUM = {};
var stateJSON = 'assets/js/data/states.json';
var hrrJSON = 'assets/js/data/hospital-referral-regions.json';
# This file should be at: ~/.ackrc
#
# ====
# Tipz
# ====
# !!! ACK ONLY SEARCHES FILE TYPES IT KNOWS ABOUT !!!
#
# To search ALL file types, use:
#
# ack -a pattern
@-webkit-keyframes fade-in {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-webkit-keyframes fade-out {
0% { opacity: 1; }
100% { opacity: 0; }
}
.animate-fade.ng-hide-add {
-webkit-animation: 250ms fade-out;
module.exports = (generate) ->
{register, copy, mkdir, set, camelcase} = generate
# Register all generators in 1 file
# Templates are run through a <%= %>
# args are automatically 'set' and available inside templates
# extend string prototype w/ handy helpers
# need a --dry-run options
register(name: "bot", args: "<name>", run: (args) ->
mkdir("src/bots/<%= name.camelcase %>")
@ratbeard
ratbeard / rat.coffee
Last active August 29, 2015 13:56
measure angular digest times and periodically log out stats
application.config(($provide) ->
# Add timing around $digest()
window.digestStats = new DigestStats
$provide.decorator("$rootScope", ($delegate) ->
$digest = $delegate.$digest.bind($delegate)
$delegate.$digest = ->
startedAt = performance.now()
$digest()
digestStats.addDuration(performance.now() - startedAt)