Skip to content

Instantly share code, notes, and snippets.

View nex3's full-sized avatar

Natalie Weizenbaum nex3

View GitHub Profile
@nex3
nex3 / gist:3262
Created July 30, 2008 13:40 — forked from collin/gist:3223
$.password
:blur
if @value === ""
.hide()
// Eventually, indenting beneath something will set it as the context
.prev()
.show().val(@default_value)
.blur()
= spans(!columns)
@for !column from 1 through !columns by 2 // through = .., to = ..., by = incrementor
+span(!column,!columns)
= span(!column, !columns)
.span-#{!column}
:width= 45px * !column + 15px
@if !column != !columns
:margin-right 15px
@nex3
nex3 / gist:11952
Created September 22, 2008 06:28 — forked from wycats/gist:11950
"foo" \
"#{10.times do}" \
"bar" \
"#{end}"
@nex3
nex3 / gist:16322
Created October 11, 2008 20:49 — forked from queso/gist:16284
# Haml blocks (and ERB blocks, for that matter) don't return their contents as a string.
# They append content directly to the template.
# Thus, you need to use #capture to get their content.
# I'm not sure why this worked with ERB; it's probably just an odd consequence of an implementation detail.
# Method
def submit(*args, &block)
@template.content_tag(:div, :class => "save_actions") do
super(*args) + @template.capture(&block)
@nex3
nex3 / gist:36969
Created December 17, 2008 06:42 — forked from Sutto/gist:36673
// General PowWow Stylesheets
=round_corners( !radius_tl = 1em, !radius_tr = !radius_tl, !radius_br = !radius_tl, !radius_bl = !radius_tr )
:-moz-border-radius
:topleft= !radius_tl
:topright= !radius_tr
:bottomleft= !radius_bl
:bottomright= !radius_br
:-webkit-border
:top
[submodule "haml"]
path = haml
url = git://github.com/nex3/haml.git
class CourseController < ApplicationController
def new
@course = Course.new
end
def input
@course = Course.new(params[:course])
if @course.save
redirect_to '/'
/* adaptation of The 1KB CSS Grid to sass (http://www.1kbgrid.com/). I love Sass.
// To use:
@import 1kbgrid.sass
+1kbgrid(12, 60px, 10px)
=1kbgrid(!num_columns = 12, !column_width = 60px, !gutter = 10px)
// calculated values
!gutter_margin = !gutter / 2
!total_column_width = !column_width + !gutter

There's a couple of problems:

  1. I can't modify JQuery UI's CSS file to create the mixin. Therefore it seems that SASS syntax is a no go. This is what drove me toward lesscss.
  2. In less, the class must exist within the same file as where the mixin is used. In other words, the only way to make this work was to @import the JQuery UI theme into the base.css file. This is not an option, as one of the objectives is to allow the user to select a theme dynamically (for example: using http://jqueryui.com/docs/Theming/ThemeSwitcher)

Sass will support cross-file selectors-as-mixins soon, as well as some sort of syntax that is as CSS-compatible as possible. For now, though, I don't see a great solution... your best bet, if you wanted to spend some effort, would probably be to hack something together with css2sass.

@nex3
nex3 / bench.rb
Created October 11, 2009 20:25 — forked from alexch/bench.rb
#!/usr/bin/env ruby
# Alex's changes:
# * erector and erector_mixin
# * each template now includes a loop and a variable (this affects HAML quite a lot)
# * automated comparison and benchmarking
# * make sure variable is truly being interpolated
# # of iterations = 10000
# user system total real