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
// Save this in a bookmarklet and click it on a page: | |
javascript:(function(){function d(a,c){document.body.style.webkitClipPath="circle("+a+"px, "+c+"px, "+b+"px)"}var b=90;window.addEventListener("mousemove",function(a){d(a.pageX,a.pageY)});window.addEventListener("mousewheel",function(a){if(a.shiftKey){a.preventDefault();var c=a.wheelDeltaY;b+=-c;b=0<c?Math.max(90,b):Math.min(b,window.innerHeight/2);d(a.pageX,a.pageY)}})})(); | |
// Or paste this in the console and mouse over the page. | |
// SHIFT+mousewheel scroll makes the circle bigger/smaller. | |
(function() { | |
var radius = 90; // px |
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 | |
# just call with ./kill_test_servers.sh buster-server|selenium|phantom | |
function get_buster_server_pid(){ | |
echo `ps aux|grep buster-server|grep node|awk '{ print $2 }'` | |
} | |
function get_selenium_server_pid(){ | |
echo `ps aux|grep selenium|grep java|awk '{ print $2 }'` | |
} |
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
# Add to routes.rb | |
# Needed for responding to OPTIONS http method | |
map.connect '*path', | |
:controller => 'home', | |
:action => 'options_for_mopd', | |
:conditions => {:method => :options} | |
# in home_controller.rb |
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
<i class="macbook"></i> |
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
set :user, 'application' | |
set :application, 'nayada' | |
set :deploy_to, "/#{user}/rails/#{application}-git" | |
ssh_options[:paranoid] = false | |
ssh_options[:port] = 389 | |
role :app0, "94.127.68.83", :primary => true | |
namespace :deploy do |
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
# This is a total hack to slow down webdriver in Capybara | |
# so you can more easily watch what is happening. | |
# paste this above the top of a Capybara Webdriver RSpec test if you need to debug something in slo-mo | |
require 'selenium-webdriver' | |
module ::Selenium::WebDriver::Remote | |
class Bridge | |
def execute(*args) |
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
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y upgrade | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.bz2 | |
tar -xvjf ruby-2.0.0-p195.tar.bz2 | |
cd ruby-1.9.3-p327/ | |
./configure --prefix=/usr/local | |
make |
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
namespace :deploy do | |
desc "Make sure there is something to deploy" | |
task :check_revision, :roles => :web do | |
unless `git rev-parse HEAD` == `git rev-parse origin/master` | |
puts "WARNING: HEAD is not the same as origin/master" | |
puts "Run `git push` to sync changes." | |
exit | |
end | |
end | |
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
# have failed jobs report via airbrake as well | |
# save it as config/initializers/delayed_job.rb | |
class Delayed::Worker | |
protected | |
def handle_failed_job_with_airbrake(job, error) | |
Airbrake.notify_or_ignore(error) | |
handle_failed_job_without_airbrake(job, error) | |
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
namespace :assets do | |
desc "Check that all assets have valid encoding" | |
task :check => :environment do | |
paths = ["app/assets", "lib/assets", "vendor/assets"] | |
extensions = ["js", "coffee", "css", "scss"] | |
paths.each do |path| | |
dir_path = Rails.root + path |