Skip to content

Instantly share code, notes, and snippets.

View timriley's full-sized avatar

Tim Riley timriley

View GitHub Profile
@henrik
henrik / augmentations.rb
Last active August 29, 2015 14:18
Ruby mixins that support class method definitions and calls just as you would in the class itself, without (ab)using the self.included hook. Modified version of https://github.com/henrik/augmentations to support block arguments.
# By Henrik Nyh 2015-04-02 under the MIT license.
class ::Object
def self.augment(*mods, **opts)
mods.each { |mod| class_exec **opts, &mod.augmentation }
end
end
class ::Module
def augmentation(**opts, &block)
@geelen
geelen / 1_Readme.md
Last active August 29, 2015 14:21
Traits

Global traits, local components

The idea is to combine the best bit of global styling (reuse, small payload) and local styling (total isolation, first-class React syntax)

This is combined with the concept of traits: you can think of them as permitted property/value pairs. Instead of every component being able to have every CSS property available to it, you can reduce your permitted set to X font families, Y font-size + line-height pairs, Z foreground/background colour pairs, W padding amounts. This is based off my work using amcss on real projects — traits were the single key feature that kept me using AM.

The one-sentence explanation: A site defines a set of permitted visual features, all components are simply a combination of those features

Definitions

@pat
pat / application_controller.rb
Created June 15, 2009 21:51
Returning HTML in AJAX calls, without layouts.
# Three things to add:
# * before_filter call
# * action_has_layout? method (if you have one, combine them)
# * adjust_for_inline
#
class ApplicationController < ActionController::Base
# ...
before_filter :adjust_for_inline
/* Instructions:
*
* Download to ~/.mailplane.css
* `defaults write com.mailplaneapp.Mailplane WebKitUserStyleSheetLocationPreferenceKey -string ~/.mailplane.css`
* `defaults write com.mailplaneapp.Mailplane WebKitUserStyleSheetEnabledPreferenceKey -bool true`
*
*/
body {
font-family: Helvetica; !important
@jgallen23
jgallen23 / ir_black.taskpapertheme
Created March 31, 2010 04:36
TaskPaper IRBlack Theme
<theme>
<!-- Window Style -->
<color id="foreground" red="0.59" green="0.80" blue="0.99" alpha="1.0" />
<color id="background" red=".1" green=".1" blue=".1" alpha=".95" />
<window foregroundColorID="foreground" backgroundColorID="background" shouldUseHUDScrollers="yes" />
<!-- Text View Style -->
<color id="tag" red=".48" green=".48" blue=".48" alpha="1.0" />
<color id="handle" extendsColorID="foreground" />
<color id="insertionPoint" red=".4" green=".4" blue=".4" alpha="1.0" />
#!/usr/bin/env ruby
# [You need dropbox - http://dropbox.com/]
# cd ~/Dropbox
# mkdir ssh
# cd ssh
# git init
# cd .git/hooks
# [paste this file into post-commit]
# chmod 755 post-commit
@filterfish
filterfish / Light weight rvm
Created July 16, 2010 00:38
Lightweigh version of rvm.
#!/usr/bin/env ruby
require 'pp'
require 'pathname'
search_paths = ['/usr/local']
Conf_file = "#{ENV['HOME']}/.lrvm"
def write_path(path)
DRAFT SPECIFICATION
# Zhook: Zip + HTML + Book.
Software that displays a Zhook file is here called a Reading System (RS).
A Zhook file is a zip file with a .zhook extension, which must contain:
* index.html (the Index)
# AViewController.h
@interface AViewController : UIViewController
{
}
@property(readwrite, retain) NSString *aString;
@property(readwrite, assign, getter=isReady) BOOL ready;
# AViewController.m
@implementation AViewController
task :eg => %w[eg:examples eg:acceptance]
namespace :eg do
ExampleRoot = Rails.root+'examples'
task :examples => :test_env do
in_example_root do
FileList.new(ExampleRoot+'*.eg.rb').each {|eg| run_eg eg }
end
end