Skip to content

Instantly share code, notes, and snippets.

View jollm's full-sized avatar

Jo Gay jollm

  • Seattle, WA
View GitHub Profile
function greader_share(doc) {
if(doc.body && !doc.xmlVersion) {
var y = doc.createElement('script');
y.textContent = "var GR________bookmarklet_domain = 'http://www.google.com';";
var z = doc.createElement('script');
z.src = 'http://www.google.com/reader/ui/link-bookmarklet.js';
doc.body.appendChild(y);
doc.body.appendChild(z);
}
}
(defun center-as-central-window ()
"three windows with a large center window"
(interactive)
(delete-other-windows)
(split-window-horizontally)(split-window-horizontally)
(other-window 2)
(split-window-horizontally)
(delete-windows-for)
(other-window 2))
var content =
h('div')
.adopt(h('table'))
.adopt(h('tbody'))
.adopt(filterList).end().end().end() // div
.adopt(h('table'))
.adopt(h('tbody'))
.adopt(sortableList).end().end().end()[0]; // div dom node
(html
(let [id "filter_name"]
[:tr
[:td
[:label {:for id} "Name"]]
[:td
[:div {:dojoType "dijit.form.TextBox" :trim "true" :id id}]]]))
;; produces "<tr><td><label for=\"filter_name\">Name</label></td><td><div dojoType=\"dijit.form.TextBox\" id=\"filter_name\" trim=\"true\"></div></td></tr>"

php

Wizard and Page classes main Controller retrieves status, creates wizard and adds pages

Wizard

display a page, provide equivalent to back, next/finish (here finish will simply redirect to the CCS main page)

Page

isComplete (do we have info to proceed)

;; set up dual head if VGA1 is connected
(defcommand xrandr-on-vga1 () ()
(let* ((xrandr-output (run-shell-command "xrandr" t))
(vga1-dimensions
(let ((group-array
(nth-value 1
(cl-ppcre:scan-to-strings
"(?<=VGA connected).*?(\\d+x\\d+) \\d+\\.\\d+ \\+"
(cl-ppcre:regex-replace-all "\\s+" xrandr-output " ")))))
(if (arrayp group-array) (aref group-array 0)))))
(defun ido-bury-buffer-at-head ()
"Bury the buffer at the head of `ido-matches'.
If cursor is not at the end of the user input, delete to end of input."
(interactive)
(if (not (eobp))
(delete-region (point) (line-end-position))
(let ((enable-recursive-minibuffers t)
(buf (ido-name (car ido-matches))))
(when buf
(bury-buffer buf)
(defvar message-filter-regexp-list '("^Starting new Ispell process \\[.+\\] \\.\\.\\.$"
"^Ispell process killed$")
"filter formatted message string to remove noisy messages")
(defadvice message (around message-filter-by-regexp activate)
(if (not (ad-get-arg 0))
ad-do-it
(let ((formatted-string (apply 'format (ad-get-args 0))))
(if (and (stringp formatted-string)
(some (lambda (re) (string-match re formatted-string)) message-filter-regexp-list))
(save-excursion
(defspec
rect
"Rectangular region"
[format
:nbits (5 bits)
(let [coord (:nbits bits)]
(for [k [:xmin :xmax :ymin :ymax]]
[k coord]))]
[rules
:nbits unsigned
@jollm
jollm / wicd.lisp
Created January 13, 2012 16:50
commands to operate wicd
(defcommand wicd-x () ()
"disconnect wicd"
(run-shell-command "wicd-cli -x"))
(defcommand wicd-c () (:rest)
"Allow the user to select a network from a list"
(let ((network (second (select-from-menu
(current-screen)
(append '(("wired" "wired"))
(mapcar (lambda (v) (list (elt v 1) (elt v 0)))