Skip to content

Instantly share code, notes, and snippets.

View oc's full-sized avatar

Ole Christian Rynning oc

  • UPPERCASE
  • Oslo, Norway
View GitHub Profile
~/dev/SMIDIG/smidig2009:> rake deploy:experimental --trace
(in /Users/oc/dev/SMIDIG/smidig2009)
** Invoke deploy:experimental (first_time)
** Invoke deploy:experimental:update (first_time)
** Execute deploy:experimental:update
[[email protected]] Logging in
Password:
[[email protected]] svn up --revision HEAD /home/smidig_no/apps/smidig2009/experimental/smidig2009
At revision 68.
[[email protected]] rake gems:unpack
#!/bin/bash
if [ $UID = 0 ]
then
script=$0
test -f $script || script=$(pwd)/$(basename $0)
/usr/bin/sudo -u oc -H $script "$*"
exit
fi
gn() {
cmd=Command
test $# -gt 0 && cmd=$@
eval $cmd
growlnotify -n Shell -m "exited with $?" "$cmd"
}
#$ gn somecommand --with-args=true yes
#=> somecommand --with-args=true yes
#=> exited with 127
@oc
oc / gist:186037
Created September 13, 2009 01:19
desc "Update Scala's I18N Language traits with file = /path/to/lib/cucumber/languages.yml"
task :update_scala_i18n, :file do |t, args|
# Limitations: Will only choose first variant of translation and will CamelCase multiple words
def e(str); str.gsub(/([\\'])|(\|.*)/, '').split(/[- _?()]/).map {|w| w.capitalize}.join; end
# Parse Cucumber language.yml and write the (new) Languages.scala file
out = File.new("cuke4duke/src/main/scala/cuke4duke/Languages.scala", "w")
out << "package cuke4duke\n"
YAML.load_file(args.file).each do |key, lang|
trait = [e(lang['name']), e(lang['given']), e(lang['when']), e(lang['then'])]
# Avoid duplicate definitions of same keyword (see:Uzbek) and already defined English keywords
gn() {
cmd=Command
test $# -gt 0 && cmd=$@
eval $cmd
growlnotify -n Shell -m "exited with $?" "$cmd"
}
#!/bin/sh
exec scala "$0" "$@"
!#
import collection.mutable.ListBuffer
val random = new Random()
def sumPizzas(list:ListBuffer[Pizza]):Int = { list.foldLeft(0)(_ + _.totalPrice) }
object Orderer {
val maximumPrice = 1200
require 'rubygems'
require 'barby'
require 'prawn'
require 'barby/outputter/prawn_outputter'
require 'fastercsv'
LEN = 30
def add_data(pdf, id, name, email)
pdf.text "Hurtigregistrering", :size => 20, :at => [0, 300]
val chars = "abcdefghijklmnopqrstuvwxyz"
val rand = new scala.util.Random(System.currentTimeMillis)
def randChar(upperCase:Boolean) = {
val ch = chars(rand.nextInt(chars.length - 1))
if (upperCase) ch.toUpperCase else ch
}
scala> "Ole Christian Rynning".split(" ").map(_.map(ch => randChar(ch.isUpperCase)).mkString).mkString(" ")
res0: String = Aee Ochbivgjm Vgxwuuc
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.bring.no/logistics/shippingguide/1.0">
<soapenv:Header/>
<soapenv:Body>
<ns:ShippingGuideRequest>
<!--You may enter the following 4 items in any order-->
<ns:UserInformation>
<ns:Usercode>PUT-YOUR-USERCODE-HERE</ns:Usercode>
</ns:UserInformation>
<ns:RequestProperties>
<!--You may enter the following 8 items in any order-->
package no.rynning;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
/**
* OC's jettylauncher. DON'T MODIFY OR MOVE PLEASE!
*/