Skip to content

Instantly share code, notes, and snippets.

View aslakhellesoy's full-sized avatar
🤠
typing...

Aslak Hellesøy aslakhellesoy

🤠
typing...
View GitHub Profile
@aslakhellesoy
aslakhellesoy / table_cell_alignment.feature
Created August 29, 2012 11:28
Gherkin table alignment
Feature: table cell alignment
Scenario: Text to the left, numbers to the right
See http://en.wikipedia.org/wiki/List_of_countries_by_population
Given a table with text and numbers:
| Country | Population |
| China | 1,347,350,000 |
| United States | 314,256,000 |
| Philippines | 92,337,852 |
| Norway | 5,031,300 |
@aslakhellesoy
aslakhellesoy / try-webbit.sh
Created July 4, 2012 09:35
Small script to illustrate the speed and simplicity of Webbit.
#!/bin/bash
# Small script to illustrate the speed and simplicity of Webbit.
# For more intersting stuff using WebSockets, see https://github.com/webbit/webbit
if [ ! -f webbit-full.jar ];
then
wget https://oss.sonatype.org/content/repositories/releases/org/webbitserver/webbit/0.4.11/webbit-0.4.11-full.jar -O webbit-full.jar
fi
cat <<-EOF > TryWebbit.java
@aslakhellesoy
aslakhellesoy / gitbox.sh
Created June 1, 2012 10:14
Set up a git remote in your DropBox
#!/bin/bash
# Call this script from a local git repo to set up a dropbox remote you can push and pull to
# I keep this script under ~/Dropbox/git/gitbox.sh
# Inspired from http://stackoverflow.com/questions/1960799/using-gitdropbox-together-effectively
PWD=`pwd`
PROJECT=`basename $PWD`
pushd $HOME/Dropbox/git
git init --bare $PROJECT.git
@aslakhellesoy
aslakhellesoy / nix-build.sh
Created May 14, 2012 10:19
building-nix-on-ubuntu
sudo apt-get install docbook docbook-xsl docbook5-xml bison flex
./bootstrap.sh && ./configure --with-docbook-rng=/usr/share/xml/docbook/schema/rng/5.0 --with-docbook-xsl=/usr/share/xml/docbook/stylesheet/docbook-xsl && make && sudo make install
[core]
repositoryformatversion = 0
filemode = true
logallrefupdates = true
autocrlf = false
[remote "origin"]
url = git@github.com:FinalFive/cucumber-jvm.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
@aslakhellesoy
aslakhellesoy / project-stats.rb
Created January 26, 2012 15:55
Small script to gather some stats about a project's volatility between releases
def info(prev_tag, tag)
`git checkout -q #{tag}`
diffstat = `git diff --stat #{prev_tag} #{tag} ./lib`.split(/\n/)[-1]
insertions = /(\d+) insertions/.match(diffstat)[1].to_i rescue 0
deletions = /(\d+) deletions/.match(diffstat)[1].to_i rescue 0
sloc = /ruby=(\d+)/m.match(`sloccount lib`)[1].to_i
changes = insertions+deletions
changetrate = changes.to_f/sloc
{
@aslakhellesoy
aslakhellesoy / settings.xml
Created January 19, 2012 23:57
maven error
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:2.4
[INFO] Generating "Project Modules" report --- maven-project-info-reports-plugin:2.4
[INFO] Generating "Project Summary" report --- maven-project-info-reports-plugin:2.4
[INFO]
[INFO] --- maven-site-plugin:3.0:deploy (default-deploy) @ cucumber-jvm ---
[INFO] Parent project loaded from repository: org.sonatype.oss:oss-parent:pom:6
[INFO] Parent project loaded from repository: org.sonatype.oss:oss-parent:pom:6
scp://cukes.info/var/www/cucumber_site/cucumber/jvm/api/1.0.0.RC7/ - Session: Connection refused
scp://cukes.info/var/www/cucumber_site/cucumber/jvm/api/1.0.0.RC7/ - Session: Disconnecting
scp://cukes.info/var/www/cucumber_site/cucumber/jvm/api/1.0.0.RC7/ - Session: Disconnected
@aslakhellesoy
aslakhellesoy / Makefile
Created December 22, 2011 13:22
Publish NPM packages with Make
NAME := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).name)")
VERSION := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version)")
TARBALL := $(NAME)-$(VERSION).tgz
npm-publish:
@rm -Rf package
@mkdir package
@cp -R lib package/lib
@cp package.json package
@tar czf $(TARBALL) package
@aslakhellesoy
aslakhellesoy / Makefile
Created December 20, 2011 09:43
Fetch NPM modules with Make
node_modules: Makefile
@rm -rf $@
@mkdir -p $@
$(call get_src_module,$@,https://github.com/tastapod/node-imap/tarball/bruno-merge)
$(call get_npm_module,$@,log,1.2.0)
$(call get_npm_module,$@,connect,1.8.2)
# We have to manually fetch connect's dependencies
$(call get_npm_module,$@,qs,0.4.0)
$(call get_npm_module,$@,mime,1.2.4)
$(call get_npm_module,$@,formidable,1.0.8)
@aslakhellesoy
aslakhellesoy / SinatraStyleWebbit.java
Created December 19, 2011 13:59
Sinatra-Like DSL for Webbit
WebServer webServer = new NettyWebServer(9090);
Dsl dsl = new Dsl(webServer);
dsl.POST("/people", new HttpHandler(){
@Override
public void handleHttpRequest(HttpRequest req, HttpResponse res, HttpControl ctl) throws Exception {
int personId = 99;
res.redirect("/people/{personId}", personId);
}