Skip to content

Instantly share code, notes, and snippets.

View mulder's full-sized avatar

Nicholas Mulder mulder

  • Wealthsimple
  • Waterloo, Ontario
View GitHub Profile
@mulder
mulder / character_reference.rb
Created May 2, 2012 17:16 — forked from norman/character_reference.rb
HTML entities? We don't need no stinkin' HTML entities.
# coding: utf-8
#
# Encode any codepoint outside the ASCII printable range to an HTML character
# reference (http://bit.ly/KNupLT).
def encode(string)
string.each_codepoint.inject("") do |buffer, cp|
cp = "&#x#{cp.to_s(16)};" unless cp >= 0x20 && cp <= 0x7E
buffer << cp
end
end
@mulder
mulder / Gemfile
Created April 12, 2012 11:14 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@mulder
mulder / ar_patch.rb
Created March 20, 2012 11:21
Patch Mysql2 Adapter for AR so that we don't show tables every other request
unless Rails.env.development?
require "active_record/connection_adapters/mysql2_adapter"
module ActiveRecord
module ConnectionAdapters
class Mysql2Adapter < AbstractAdapter
extend ActiveSupport::Memoizable
memoize :tables, :pk_and_sequence_for, :columns
end
end
redis-cli KEYS "pulse:*" | xargs redis-cli DEL
[2012-01-23T08:51:15.866033 #15991]
[2012-01-23T11:34:00.499694 #23679]
[2012-01-23T11:34:00.516219 #27139]
[2012-01-23T11:34:00.757622 #23643]
[2012-01-23T11:34:00.852449 #32740]
[2012-01-23T11:34:01.201746 #5728]
[2012-01-23T11:34:01.215995 #23643]
[2012-01-23T11:34:01.433602 #23643]
[2012-01-23T11:34:01.441876 #18991]
production:
database: ts_production
username: root
password: *****
encoding: utf8
reconnect: false
pool: 5
socket: /tmp/mysql.sock
adapter: mysql2_balancer
@mulder
mulder / border.css
Created October 11, 2011 17:37
CSS3 Border transitions
a {
display:inline-block;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
width:100px;
height:100px;
-webkit-border-radius:50px;
-moz-border-radius:50px;
border-radius:50px;
class BaseRack
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
end
end
class Streamer
def initialize(records, &block)
@block = nil
@records = records
@record_block = block
end
def write(bytes)
@block.call bytes
bytes.bytesize
WCIU
FxDt
FxWi
SNet
CSN
FxAZ
FxFl
STOh
SUN
FxKC