Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Weston Triemstra thermistor

🏠
Working from home
Block or report user

Report or block thermistor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thermistor
thermistor / pedantically_commented_playbook.yml
Created May 29, 2016 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
View pedantically_commented_playbook.yml
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
View keybase.md

Keybase proof

I hereby claim:

  • I am thermistor on github.
  • I am thermistor (https://keybase.io/thermistor) on keybase.
  • I have a public key ASBiX2KnZb1zYnuWNsGrScjM7ZlOaPVS0bjWdF99-UlV3go

To claim this, I am signing this object:

@thermistor
thermistor / gist:08e039f912795166d567
Last active Jan 29, 2016
Rollbar deploy notification using ENV variable from dotenv
View gist:08e039f912795166d567
require 'dotenv/tasks'
task notify_rollbar: :dotenv do
on roles(:app) do |h|
revision = `git log -n 1 --pretty=format:"%H"`
local_user = `whoami`.chomp
rollbar_token = ENV['ROLLBAR_ACCESS_TOKEN']
rails_env = fetch(:rails_env, 'production')
execute :curl, "https://api.rollbar.com/api/1/deploy/ -F access_token=#{rollbar_token} -F environment=#{rails_env} -F revision=#{revision} -F local_username=#{local_user} >/dev/null 2>&1", :once => true
end
View clearfix.css
/**
* 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.
@thermistor
thermistor / delayed_job.cap
Created Oct 24, 2013
Delayed Job tasks for Capistrano 3, save in lib/capistrano/tasks.
View delayed_job.cap
namespace :delayed_job do
def args
fetch(:delayed_job_args, "")
end
def delayed_job_roles
fetch(:delayed_job_server_role, :app)
end
View turbodev.rb
# 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:
#
View msp_number_generator.rb
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
View makeapp.sh
#!/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
@thermistor
thermistor / gist:4064149
Created Nov 13, 2012 — forked from ebidel/gist:3723309
Spotlight bookmarklet
View gist:4064149
// 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
@thermistor
thermistor / kill_test_servers.sh
Created Nov 6, 2012 — forked from trodrigues/kill_test_servers.sh
kill script for phantom, buster, selenium
View kill_test_servers.sh
#!/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 }'`
}
You can’t perform that action at this time.