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 assets.rake
require 'non_digest_assets'
namespace :assets do
task :non_digested do
NonDigestAssets.new.generate
end
end
View readme.md

console.log wrap resolving for your wrapped console logs

I've heard this before:

What I really get frustrated by is that I cannot wrap console.* and preserve line numbers

We enabled this in Chrome DevTools via blackboxing a bit ago.

If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.

@thermistor
thermistor / perfect_mock.rb
Last active Aug 29, 2015
A perfect ruby mock
View perfect_mock.rb
# from http://taylor.fausak.me/2014/05/24/class-comparison-in-ruby/
require 'forwardable'
def fake(klass)
Class.new(BasicObject) do
eigenclass = class << self; self end
eigenclass.extend Forwardable
eigenclass.def_delegators klass, *%i[
<
<=
View policy.rb
require 'virtus'
class User
include Virtus.model
attribute :confirmed_at, Time
attribute :subscribed, Boolean, default: false
end
class Screencast
View translator.rake
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
)
View gist:11226769
## 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;
You can’t perform that action at this time.