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
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;
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 =
from: from.to_sym,
to: to.to_sym
View policy.rb
require 'virtus'
class User
include Virtus.model
attribute :confirmed_at, Time
attribute :subscribed, Boolean, default: false
class Screencast
thermistor / perfect_mock.rb
Last active Aug 29, 2015
A perfect ruby mock
View perfect_mock.rb
# from
require 'forwardable'
def fake(klass) do
eigenclass = class << self; self end
eigenclass.extend Forwardable
eigenclass.def_delegators klass, *%i[

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.

View assets.rake
require 'non_digest_assets'
namespace :assets do
task :non_digested do
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/*.feature"
View Instrument Anything in Rails

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
thermistor / assets.rake
Created Oct 20, 2011 — forked from shedd/assets.rake
Check asset encoding for valid UTF-8
View assets.rake
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
You can’t perform that action at this time.