Skip to content

Instantly share code, notes, and snippets.

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
}
# 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() {
config.jobs = ActiveSupport::OrderedOptions.new
# Controls whether or not workers report heartbeats
config.jobs.heartbeat_enabled = true
# How often workers should send heartbeats
config.jobs.heartbeat_interval_seconds = 60
# How long a worker can go without sending a heartbeat before they're considered dead
config.jobs.heartbeat_timeout_seconds = 3 * 60
# How often to check for dead workers
config.jobs.dead_worker_polling_interval_seconds = 60
require "rspec"
require "json"
require "dry-types"
require "dry-validation"
module Types
include Dry::Types.module
RegionCode = Types::Strict::String.constrained(
format: /\A(au|nz|uk|ie)\z/,
@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
version: '2.0'
services:
couchpotato:
image: linuxserver/couchpotato
ports:
- 5050:5050
volumes:
- couchpotato:/config:rw
- movies:/movies:rw
- downloads:/downloads:rw
@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