Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ $UID = 0 ]
then
script=$0
test -f $script || script=$(pwd)/$(basename $0)
/usr/bin/sudo -u oc -H $script "$*"
exit
fi
Feature: Google
In order to test a remote site
I surf to google
And take a look
Scenario: Trying Google
When I go to the homepage
And I fill in "Aslak Hellesoy" for the field named "q"
And I press "Google Search"
Then I should see "So little to do - so much time"
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
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!
*/
@reagent
reagent / env.rb
Created March 1, 2010 16:14
Simple Cuke stuff
require 'rubygems'
require 'cucumber'
require 'capybara'
require 'capybara/cucumber'
require 'capybara/session'
Before do
Capybara.current_driver = :selenium
@jlindsey
jlindsey / culerity.js
Created June 3, 2010 16:47
Using Cucumber/Capybara/Culerity, a step to wait until all AJAX calls are complete.
// this allows culerity to wait until all ajax requests have finished
jQuery(function($) {
var original_ajax = $.ajax;
var count_down = function(callback) {
return function() {
try {
if(callback) {
callback.apply(this, arguments);
};
} catch(e) {
@oc
oc / Main.java
Created September 16, 2010 17:14
package no.muda.jetty;
import org.constretto.ConstrettoBuilder;
import org.constretto.ConstrettoConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.webapp.WebAppContext;
import org.springframework.core.io.DefaultResourceLoader;
import java.io.IOException;
@DmitrySoshnikov
DmitrySoshnikov / python-closures.py
Created November 15, 2010 12:03
Understanding Python's closures
# "Understanding Python's closures".
#
# Tested in Python 3.1.2
#
# General points:
#
# 1. Closured lexical environments are stored
# in the property __closure__ of a function
#
# 2. If a function does not use free variables
@tj
tj / hidden-classes.js
Created January 6, 2011 03:32
V8 hidden class benchmark
// 10m
var times = 10000000;
var n = times
, start = new Date;
while (n--) {
var point = [50,100];
point[0];
point[1];
@irrationalidiot
irrationalidiot / description
Created April 5, 2011 14:13 — forked from jacortinas/description
Cucumber, rspec and spork setup using watchr for rails
Gems:
gem 'cucumber'
gem 'cucumber-rails'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'spork'
gem 'watchr'