Skip to content

Instantly share code, notes, and snippets.

package com.quotelibrary.snippet
import _root_.net.liftweb.http._
import S._
import SHtml._
import js._
import JsCmds._
import JE._
import _root_.net.liftweb.util._
import Helpers._
@tjweir
tjweir / gist:20980
Created November 18, 2008 01:32
undefined
package com.quotelibrary.snippet
import _root_.net.liftweb.http._
import S._
import SHtml._
import js._
import JsCmds._
import JE._
import _root_.net.liftweb.util._
import Helpers._
#! /bin/sh
#/usr/bin/mvn $* | awk '{ print; if($0 ~ ".*Downloading.*") system("/usr/local/bin/growlnotify -n mavenError -t Maven Downloading -m\""$0 "\"") if($0 ~ ".*ERROR.*") system("/usr/local/bin/growlnotify -n mavenError -t Maven Error -m\""$0 "\"") } END { system("/usr/local/bin/growlnotify -n mavenComplete -t Maven -m \"Build Complete\"") }'
/usr/bin/mvn $* | awk '{ print;
if($0 ~ ".*Downloading.*")
system("/usr/local/bin/growlnotify -n mavenError -t Maven Downloading -m\""$0 "\"")
if($0 ~ ".*ERROR.*") system("/usr/local/bin/growlnotify -n mavenError -t Maven Error -m\""$0 "\"") }
END {
system("/usr/local/bin/growlnotify -n mavenComplete -t Maven -m \"Build Complete\"") }'
Vim replace commands to fix goofy quotes in Lyx
:%s/\\begin_inset Quotes eld\n\\end_inset/"/g
:%s/\\begin_inset Quotes erd\n\\end_inset/"/g
@tjweir
tjweir / x
Created December 31, 2008 16:46
Use Ubiquity to search Lift's API.
CmdUtils.CreateCommand({
name: "lift",
homepage: "http://praytothemachine.com/evil/code/ubiquity/lift.js",
description: "Search Lift's API",
help: "Simply type lift and the classname and it will do a google search for API documentation on that class",
icon: "http://www.scala-lang.org/sites/default/files/favicon.gif",
takes: {"class name": noun_arb_text},
preview: function(pblock, directObject) {
var searchTerm = directObject.text;
var pTemplate = "Searches Lift Docs for <b>${query}</b>";
// I never remember....
shell> mysqldump db_name > backup-file.sql
shell> mysql db_name < backup-file.sql
@tjweir
tjweir / .bashrc
Created January 15, 2009 14:59 — forked from henrik/.bashrc
# I made a change to the PS1, I prefer my dirpath on a line above the prompt,
# so the prompt does not wind up at the right edge in deep trees.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
@tjweir
tjweir / Process HTML in scala
Created January 21, 2009 16:51
Process HTML in scala
/*From: http://www.nabble.com/More-elegant-way-of-reading-HTML-from-a-URL-than-this--to21576710.html
*/
class URLLineReader(url: String) {
val reader = new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(url).openStream(), "US-ASCII"));
def foldLeft[T](init: T)(f: (T, String) => T): T = reader.readLine match {
case null => init
case line => foldLeft(f(init, line))(f)
}
}
I forget this a lot:
http://css.maxdesign.com.au/listamatic/horizontal01.htm
HTML
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="#" id="current">Item one</a></li>
<li><a href="#">Item two</a></li>
<li><a href="#">Item three</a></li>
<li><a href="#">Item four</a></li>
object MyPayPalIPN extends PayPalIPN {
def actions = {
case (action, info, _) => {
val payAmt: Long = info.paymentGross match {
case Full(gross) => gross.roboSplit("\\.") match {
case whole :: fraction => println("split case");toLong(whole) * 100 + toLong(fraction)
case _ => println("non-split case"); toLong(info.paymentGross)
}
case _ => 0
}