Instantly share code, notes, and snippets.

View tache-layouts.rb
require 'tache'
layout = <<-eos
<html>
<head>
<title>{{#layout.title}}Default Title{{/layout.title}}</title>
</head>
<body>
{{#layout.content}}Default Content{{/layout.content}}
</body>
View gist:7237043
<!-- Suck on this BEM! -->
<section aria-labelledby="latest-products">
<h2 id="latest-products">Latest Products</h2>
<ul>
...
</ul>
</section>
<section aria-labelledby="press-news">
View issue-3144.rb
Mongoid.connect_to 'mongoid-3144'
class Post
include Mongoid::Document
field :name
embeds_many :comments
accepts_nested_attributes_for :comments
# This line somehow triggers the bug; commenting it out fixes the bug, wierd.
View osx-tabs.sh
function tabname {
# Will use current dir name if called without arg.
printf "\e]1;${1-$(basename `pwd`)}\a"
}
function winname {
# Will use current dir name if called without arg.
printf "\e]2;${1-$(basename `pwd`)}\a"
}
function tab {
# Will cd into current dir if called without arg.
View scale.scss
// Example usage:
// $size-1: 13;
// $size-2: 15;
// $size-3: golden($size-1, 1);
// $size-4: golden($size-2, 1);
// $size-5: golden($size-1, 2);
// $size-6: golden($size-2, 2);
//
// In conjunction with rhythm (https://gist.github.com/thelucid/5730434):
// @include font($size-3);
View rhythm.scss
$rhythm-base: 16;
$rhythm-size: 26;
// Converts any non-zero, unitless number values from pixels to rems
// with a pixel fallback for old browsers.
//
// Example:
// @include rem('padding', 32 5%);
//
// Output:
View gist:4437186
require 'tache/safe'
# ORM-like base class
class Model
def initialize(attributes = {})
attributes.each { |key, value| send "#{key}=", value }
end
def destroy
'Successfully destroyed!'
View gist:4436684
require 'tache/safe'
# ORM-like base class
class Model
def initialize(attributes = {})
attributes.each { |key, value| send "#{key}=", value }
end
def destroy
'Successfully destroyed!'