Skip to content

Instantly share code, notes, and snippets.

@gkop
gkop / gist:1371962
Created November 17, 2011 00:13
Capture javascript errors in Cucumber+Capybara+Webdriver tests
# in features/support/env.rb
require 'selenium/webdriver'
# we need a firefox extension to start intercepting javascript errors before the page
# scripts load
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
# see https://github.com/mguillem/JSErrorCollector
profile.add_extension File.join(Rails.root, "features/support/extensions/JSErrorCollector.xpi")
Capybara::Selenium::Driver.new app, :profile => profile
ffprobe -version
ffprobe version 3.0.2-4 Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.4.0 (Debian 5.4.0-3) 20160603
configuration: --prefix=/usr --extra-version=4 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --e
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" minBufferTime="PT12S" suggestedPresentationDelay="PT0S" type="static" mediaPresentationDuration="PT6S">
<Period id="0" start="PT0S">
<AdaptationSet segmentAlignment="true">
<SegmentTemplate presentationTimeOffset="356038323" timescale="90000" media="http://ilab-dst1.philo.com:8000/video/$Bandwidth$/$Time$.ismv" initialization="http://ilab-dst1.philo.com:8000/video/$Bandwidth$/init.mp4">
<SegmentTimeline>
<S t="356038323" d="270270"/>
</SegmentTimeline>
</SegmentTemplate>
<Representation id="0-video" mimeType="video/mp4" codecs="avc1.4d401f" width="1280" height="720" frameRate="30000/1001" sar="1:1" startWithSAP="1" bandwidth="2085966"/>
@gkop
gkop / hlsclient_input_webm.json
Created June 2, 2016 19:35 — forked from jbochi/hlsclient_input_webm.json
New input JSON for hlsclient
{
"streams": {
"Nasa-high": {
"input-path": "/msfc/Wifi.m3u8",
"servers": ["http://liveips.nasa.gov.edgesuite.net"],
"bandwidth": 1080434
}
},
"actions": [
➜ family git:(master) guard
13:44:59 - INFO - LiveReload is waiting for a browser to connect.
13:44:59 - INFO - Guard::Minitest 2.4.2 is running, with Minitest::Unit 5.8.4!
13:44:59 - INFO - Running: all tests
13:45:05 - INFO - Browser connected.
/home/gabe/binti/family/spec/spec_helper.rb:19:in `<top (required)>': undefined method `configure' for RSpec:Module (NoMethodError)
from /home/gabe/.rvm/gems/ruby-2.3.0@family/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
from /home/gabe/.rvm/gems/ruby-2.3.0@family/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/gabe/.rvm/gems/ruby-2.3.0@family/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/gabe/.rvm/gems/ruby-2.3.0@family/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
rake newb
rm -rf doc
/home/gabe/play/ruby_parser/tmp/isolate/ruby-2.3.0/bin/rdoc --title ruby_parser-3.8.1 Documentation -o doc --main README.txt lib History.txt Manifest.txt README.txt
Parsing sources...
100% [ 8/ 8] lib/ruby_parser_extras.rb
Generating Darkfish format into /home/gabe/play/ruby_parser/doc...
Files: 8
@gkop
gkop / dog.coffee
Created January 29, 2014 04:48
Dog class in coffee
class Dog
age: ->
@human_age * 7.002
my_dog = new Dog()
my_dog.human_age = 4.5
my_dog.name = "Stewie"
my_dog.greeting = ->
"Woof! I'm #{this.name}"
@gkop
gkop / gist:6701598
Last active December 23, 2015 22:09
Blacklist known-incompatible browsers and versions in Rails
# assumes UserAgent gem is available
# https://rubygems.org/gems/useragent
class ApplicationController < ActionController::Base
# blacklist recognized browser with lower versions than those below
Browser = Struct.new(:browser, :version)
BROWSERS = [
Browser.new("Chrome", "3.0"),
Browser.new("Firefox", "3.0"),
@gkop
gkop / tweaks.md
Last active December 17, 2015 17:19
Tweaks to ElasticBeanstalk's default Ruby AMI to install gems locally to application

Tweaks to ElasticBeanstalk's default Ruby AMI to install gems locally to application

in /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh

Replace bundle with bundle exec at line 13


in /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh

@gkop
gkop / Gemfile
Last active December 14, 2015 01:49
Bundle from git a gem with additional require paths
source 'https://rubygems.org'
# bundle from git and the ext/ directory in the gem is not found in the require path
gem 'rbtagger', :git => "git://github.com/taf2/rb-brill-tagger.git"
# bundling from rubygems or local path works, however
# gem 'rbtagger'
# or
# gem 'rbtagger', :path => "~/play/rb-brill-tagger"