Skip to content

Instantly share code, notes, and snippets.

@caged
caged / graphite.md
Created March 3, 2012 20:25
Installing Graphite on OS X Lion

This is a general overview (from memory) of the steps I used to install graphite (http://graphite.wikidot.com) on OS X Lion. I think the steps are in order but YMMV. Please fork and fix if you find an error.

Install Python 2.7.2

brew install python

Check your env

$ python --version
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
module DelayedJob
module Matchers
def enqueue_delayed_job(handler)
DelayedJobMatcher.new handler
end
class DelayedJobMatcher
def initialize(handler)
@handler = handler
@attributes = {}
class TeamFactory
class PageValue < OpenStruct.new(:page, :name)
end
def self.build_from_individual_page page, name = nil, builder = self
value = PageValue.new page, name
team = builder.build_team value
team_page = builder.build_team_page value
builder.persist! team, team_page
team
anonymous
anonymous / gist:4316368
Created December 17, 2012 07:09
+ vendor($p,$v)
-webkit-#{$p}: $v
-moz-#{$p}: $v
-ms-#{$p}: $v
-o-#{$p}: $v
#{$p}: $v
$shadow: 0px 1px 0px rgba(#fff,0.1), 0px -1px 0px rgba(#000,0.01)
#logo
anonymous
anonymous / gist:4333310
Created December 19, 2012 00:09
(function(root) { // Wrap our entire code in anyonmous function. Minimise your chance to leak scope into the global namespace. See last line.
'use strict'; // http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it
var $ = root.$; // Convient access to the jQuery object. Chaining is expensive in JS.
root.Search = (function() { // Wrap the entire class in an anonymous function. This guarantees we will not leak scope. We assign the class to the root object. In this case, window.
function Search(el) { // Create a search object. This is also the constructor for the class.
this.el = el;// Assign an ivar
}
@mislav
mislav / fat-logfiles.sh
Last active December 22, 2018 19:56
Find "*.log" files in your home dir, sort them by fattest-first, and calculate the size of them all together.
find ~ -name '*.log' -print0 | xargs -0 -L1 stat -f'%z %N' | sort -rn | tee fat-logfiles.txt | head
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt
# RecursiveClosedStruct is similar to OpenStruct, except:
#
# * Immutable. Cannot be changed after instantiation.
# * Raises NoMethodError on undefined methods instead of returning nil.
# * Recursively coerces descendants into a RecursiveClosedStruct.
#
# NoMethodError example:
# struct = RecursiveClosedStruct.new(key1: "value")
# struct.key1 # => "value"
# struct.key2 # => NoMethodError
var MyClass = function() {
this.myAttribute = 1;
return this;
};
MyClass.classMethod = function() {
};
MyClass.prototype.instancMethod = function() {
@jonleighton
jonleighton / gist:7122210
Created October 23, 2013 16:48
Report Rails deprecation warnings to Honeybadger (useful in production if there might be lines of code not covered by your tests - the horror!). Place this in your config/environments/production.rb
ActiveSupport::Notifications.subscribe('deprecation.rails') do |name, start, finish, id, payload|
Honeybadger.notify(
error_class: "DEPRECATION WARNING",
error_message: payload[:message],
backtrace: payload[:callstack]
)
end