Skip to content

Instantly share code, notes, and snippets.

@tommyh
tommyh / json_matcher.rb
Created May 18, 2011 02:01
Rspec Matcher: Valid Json
#in controller test
# response.body.should be_valid_json
RSpec::Matchers.define :be_valid_json do
match do |actual|
JSON.parse(actual)
end
end
@tommyh
tommyh / gist:1549606
Created January 2, 2012 06:37
OSX Lion - Machine Bootstrap (rails, mysql, rvm, rubymine, etc)
# Prereqs
# os x (i have lion)
# install Xcode from the "App Store"
#install soloist gem
sudo gem install soloist --no-ri --no-rdoc
#create a dir to store your soloist cookbooks
mkdir -p ~/projects && cd ~/projects
mkdir -p chef/cookbooks/pivotal_workstation && cd chef/cookbooks/pivotal_workstation
@tommyh
tommyh / gist:6706987
Last active December 23, 2015 22:59
This is a workaround for intermittent timing issues with the capybara/poltergeist/phantomjs stack. Approach: have each iframe phone home to the parent page on dom ready. In capybara, you can use this knowledge that the iframe has fully loaded before you attempt to use "within_frame" for the iframe.
# app/views/layouts/application.haml
= render "shared/test_iframe_loaded"
# app/views/shared/_test_iframe_loaded.haml
- if Rails.env.test?
:javascript
(function(){
if(window.top !== window.self){
$(document).ready(function(){
window.JasmineReact = {};
JasmineReact.renderComponent = function(component, container){
var done = false,
callback = function(){ done = true; },
isDone = function(){ return done; };
if(typeof container === "undefined" ){
container = document.getElementById("jasmine_content");
}
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="http://www.flashls.org/videojs/video-js.css" rel="stylesheet" type="text/css">
<script src="http://www.flashls.org/videojs/video.js"></script>
<script>
videojs.options.flash.swf = "http://www.flashls.org/videojs/video-js.swf";
</script>
</head>
@tommyh
tommyh / hls_capleveltostage_default.html
Created August 5, 2015 17:37
Videojs: flashls: capleveltostage default
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="http://www.flashls.org/videojs/video-js.css" rel="stylesheet" type="text/css">
<script src="http://www.flashls.org/videojs/video.js"></script>
<script>
videojs.options.flash.swf = "http://tout-development.site.s3.amazonaws.com/tomhallettest/video-js-mangui-dist.swf";
</script>
</head>
@tommyh
tommyh / hls_startfromlevel_0.html
Last active August 29, 2015 14:26
flashls: hsl_startfromlevel=0 confusion
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="http://www.flashls.org/videojs/video-js.css" rel="stylesheet" type="text/css">
<script src="http://www.flashls.org/videojs/video.js"></script>
<script>
videojs.options.flash.swf = "http://tout-development.site.s3.amazonaws.com/tomhallettest/video-js-mangui-dist.swf";
videojs.options.flash.flashVars = { hls_startfromlevel: 0 };
</script>
@tommyh
tommyh / hired_dot_com_hide_salary_information.js
Created October 9, 2015 17:43
Hired.com: Hide Salary Information Bookmarklet
(function(){
var salaryElementSelector = ".salary, .subheading__salary, .offer-text, .candidate-info--salary, .btn-one-click-offer span",
salaryElements = document.querySelectorAll(salaryElementSelector);
for (var i = 0; i < salaryElements.length; ++i) {
salaryElements[i].style.display = "none";
}
})();
/*
Copyright (c) 2008-2015 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@tommyh
tommyh / README.md
Last active November 5, 2015 22:30
Tout: Wordpress Fix

Tout: Wordpress fix

Some wordpress themes have css styles which modify the height attribute for video players, resulting in a player element which has a small height and is broken. These css styles will fix those issues.