NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
/ A simplistic way of loading and rendering HAML partials (header.haml, footer.haml, nav.haml... you name it) without Rails | |
/ Useful when using tools like LiveReload http://livereload.com/ | |
/ but don't want to configure a web server just to use PHP include/require constructs (discussion http://help.livereload.com/discussions/questions/22-haml-partials) | |
/ It could be improved/simplified using a helper http://stackoverflow.com/questions/5436769/partial-haml-templating-in-ruby-without-rails/5436973#5436973 | |
/ Check out the Jade version https://gist.github.com/2593727 | |
%html | |
%body | |
%header | |
= Haml::Engine.new(File.read('/path/to/your/partial.haml')).render |
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
# Basic Ruby code to read and write ".webloc" files (as used on OS X) | |
# Reads both "old" Safari style and newer plist style | |
# Writes "old" style only | |
# Works on Ruby 1.9.2 and 1.8.7 | |
require 'plist' | |
class Webloc | |
attr_accessor :url |
In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.
For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); |
#!/usr/bin/ruby | |
# | |
# wad - watch and run | |
# watches files and runs a command when they change | |
# | |
# usage: wad <files> <command> | |
# | |
# example: | |
# ./wad index.html stylesheets/*.sass "sass stylesheets/main.sass stylesheets/main.css; open -g http://127.0.0.1:8000/" |