Skip to content

Instantly share code, notes, and snippets.

View thermistor's full-sized avatar
🏠
Working from home

Weston Triemstra thermistor

🏠
Working from home
View GitHub Profile
@thermistor
thermistor / kill_test_servers.sh
Created November 6, 2012 17:59 — forked from trodrigues/kill_test_servers.sh
kill script for phantom, buster, selenium
#!/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 }'`
}
@thermistor
thermistor / gist:4064149
Created November 13, 2012 05:35 — forked from ebidel/gist:3723309
Spotlight bookmarklet
// 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
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
def valid_msp_number(msp_number)
weights = [0, 2, 4, 8, 5, 10, 9, 7, 3, 0]
total = 0
weights.to_enum.with_index(1).each do |weight, i|
total = total + msp_number[i-1].to_i * weight.to_i
end
a = total / 11
b = a * 11
c = total - b
result = 11 - c
@thermistor
thermistor / turbodev.rb
Created September 7, 2013 01:45
turbodev!
# Extracted from http://git.io/HeGfdA
# Full credit to https://github.com/SamSaffron
#
# Middleware that causes static asset requests to bypass rails altogether. This
# can make requests a lot faster. From 4.5s to 1.5s in some apps. Only relevant
# in development environments as production already does this.
#
# Put this file in lib/middleware and add the following code to your
# development.rb environment file:
#
@thermistor
thermistor / delayed_job.cap
Created October 24, 2013 19:22
Delayed Job tasks for Capistrano 3, save in lib/capistrano/tasks.
namespace :delayed_job do
def args
fetch(:delayed_job_args, "")
end
def delayed_job_roles
fetch(:delayed_job_server_role, :app)
end
/**
* Source: http://nicolasgallagher.com/micro-clearfix-hack/
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
## FILL ##
fill Sets fill color of the shape.
fill-opacity Sets fill opacity of the shape.
fill-rule Sets fill rule of the shape.
** example **
fill: #ccc;
fill: rgba(0,0,0,.5);
fill: red;
--colour
-I app
namespace :translator do
desc "Export missing translations for a specific locale"
task :export_keys => :environment do
from = ENV['FROM']
to = ENV['TO']
if from.present? and to.present?
translator = Translator.new(
from: from.to_sym,
to: to.to_sym
)