Skip to content

Instantly share code, notes, and snippets.

[al3x@rawls spde:master]$ buildr run --trace
2009-03-04 13:45:41.456 ruby[3687:10b] RBCocoaInstallRubyThreadSchedulerHooks: couldn't find autoreleasePool ivar
(in /Users/al3x/src/third_party/scala/spde, development)
** Invoke buildr:initialize (first_time)
** Execute buildr:initialize
** Invoke spde (first_time)
** Execute spde
** Invoke /Users/al3x/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar (first_time, not_needed)
** Invoke /Users/al3x/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar (first_time, not_needed)
** Invoke /Users/al3x/.m2/repository/org/apache/ant/ant-trax/1.7.1/ant-trax-1.7.1.jar (first_time, not_needed)
class Primary
def hello
puts "hello from Primary"
end
def call_hello
hello
end
end
@al3x
al3x / gist:54290
Created January 29, 2009 00:56
MacPorts choking on texlive
[al3x@rawls ~]$ sudo port sync; sudo port upgrade outdated
Password:
---> Building texlive_base
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_tex_texlive_base/work/texlive_base-2007" && make all " returned error 2
Command output: make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all'.
make all-recursive
Making all in data
make[4]: Nothing to be done for `all'.
Making all in src
function rbdiff {
local branch
branch=$(git name-rev --name-only head)
git diff master..HEAD > "~/Desktop/${branch}.diff"
}
#!/usr/bin/php -q
<?php
// modified from http://3v1n0.tuxfamily.org/scripts/detextile/HTML-to-Textile.php
class html2textile {
function detextile($text) {
$text = preg_replace("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtolower('\\2').'\\3'", $text);
$text = preg_replace("/<br[ \/]*>\s*/","\n",$text);
$text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $text);
$text = stripslashes($text);
$oktags = array('p','ol','ul','li','i','b','em','strong','span','a','h[1-6]',
@al3x
al3x / gist:20577
Created October 29, 2008 01:39
.screenrc
startup_message off
defscrollback 5000
autodetach on
hardstatus alwayslastline "%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]"
@al3x
al3x / euler 52
Created October 27, 2008 19:49 — forked from anonymous/euler 52
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
URL: http://projecteuler.net/index.php?section=problems&id=52
Problem summary goes here:
It can be seen that the number, 125874, and its double, 251748, contain
exactly the same digits, but in a different order.
@al3x
al3x / Dear Red States
Created October 26, 2008 19:20
An email forwarded to me. I LOL'd.
Dear Red States,
We've decided we're leaving. We intend to form our own country, and we're taking the other Blue
States with us. In case you aren't aware, that includes Hawaii, California, Oregon, Washington,
Minnesota, Wisconsin, Michigan, Illinois, New York, and all of the Northeastern states. After this
election, we'll be adding Colorado and New Mexico. We believe this split will be beneficial to the
nation, especially to the people of our new country - Nuevo California.
To sum up briefly: You get Texas, Oklahoma and all the slave states; we get stem cell research, the
best beaches, and the best ski resorts. We get Elliot Spitzer; you get Ken Lay. We get the Statue of
@al3x
al3x / gist:17018
Created October 15, 2008 21:40 — forked from mzsanford/gist:17017
Jetty from Scala
import java.util.logging.Logger
import javax.servlet.http.{HttpServletRequest, HttpServletResponse}
import org.mortbay.jetty.Server
import org.mortbay.jetty.handler.AbstractHandler
object Test extends AbstractHandler {
val log = Logger.getLogger("handler")
def main(args : Array[String]) = {
trait WhoAreYou {
def whatClassAmI: Class[_] = this.getClass
println("I've been mixed into " + whatClassAmI)
if (whatClassAmI == classOf[Bar]) {
println("Holy cow batman, I'm part of a Bar")
}
}
class Foo extends WhoAreYou