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)
# Thanks to Bill Clementson for parts of this snippet
# http://bc.tech.coop/
function start_or_join_screen {
if [ "$TERM" != dumb -a "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" ]
then
STARTED_SCREEN=1 ; export STARTED_SCREEN
sleep 1
if screen -RR
then
(defun gist-make-query-string (params)
"Returns a query string constructed from PARAMS, which should be
a list with elements of the form (KEY . VALUE). KEY and VALUE
should both be strings."
(mapconcat
(lambda (param)
(concat (url-hexify-string (car param)) "="
(url-hexify-string (cdr param))))
params "&"))
;;;###autoload
(defun gist-region (begin end &optional private)
"Post the current region as a new paste at gist.github.com
Copies the URL into the kill ring.
With a prefix argument, makes a private paste."
(interactive "r\nP")
(let* ((file (or (buffer-file-name) (buffer-name)))
(name (file-name-nondirectory file))
;;;###autoload
(defun gist-region (begin end &optional private)
"Post the current region as a new paste at gist.github.com
Copies the URL into the kill ring.
With a prefix argument, makes a private paste."
(interactive "r\nP")
(let* ((file (or (buffer-file-name) (buffer-name)))
(name (file-name-nondirectory file))
(ext (or (cdr (assoc major-mode gist-supported-modes-alist))
(
(