Skip to content

Instantly share code, notes, and snippets.

View ckizer's full-sized avatar
💭
Looking for Work

Court K ckizer

💭
Looking for Work
View GitHub Profile
@janogarcia
janogarcia / haml_partials.haml
Created May 3, 2012 11:28
HAML Partials wihout Rails (useful for LiveReload)
/ 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
@necolas
necolas / README.md
Last active March 28, 2024 20:34
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.

Pattern

t-template-name
@peterc
peterc / webloc.rb
Created January 26, 2011 04:19
Basic Ruby code to read and write ".webloc" files (as used on OS X)
# 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

Sass/Less Comparison

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.

Variables

// 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);
@peterc
peterc / wad.rb
Created January 25, 2010 17:45
watches files and runs a command when they change
#!/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/"