Skip to content

Instantly share code, notes, and snippets.

View pyykkis's full-sized avatar

Jarno Keskikangas pyykkis

  • Subtle Insights Oy
  • Finland
View GitHub Profile
@pyykkis
pyykkis / data.coffee
Created February 21, 2012 09:43
Transparency example: Nested lists with category titles
data = [
title: "Cat A"
items: [{name: "foo"},{name: "bar"}]
,
title: "Cat b"
items: [{name: "hello"}, {name: "world"}]
]
@pyykkis
pyykkis / kata-potter.clj
Created November 13, 2011 16:41
Clojure implementation for KataPotter
(def book-price 8)
(def discounts [1 1 0.95 0.90 0.80 0.75])
(defn price [books]
(let [uniques (set books)
discount (discounts (count uniques))]
(+ (* (count uniques) book-price discount))) (price (remove books uniques)))
@pyykkis
pyykkis / index.jade
Created September 4, 2011 14:10
Extremely simple js templates by convention: css class(+attribute) == json object field
div A single activity
ul.activity
li.date
li.activity
li.comment
li.user
div Multiple activities
table
tr
@pyykkis
pyykkis / rspec_intro.rb
Created August 31, 2011 03:57
Mock objects rspec style
-----------------
my_world.rb
class MyWorld
def initialize
@king = King.new
end
def king_of_the_world
@pyykkis
pyykkis / rspec_DI_intro.rb
Created August 31, 2011 03:52
Feeding mock objects DI style
-----------------
my_world.rb
class MyWorld
def initialize
@king = King.new
end
def king_of_the_world
@pyykkis
pyykkis / api.feature
Created April 19, 2011 14:20
Failing cucumber scenario
Scenario: Sending REST import first with user defined test environment and then without
Given I have sent a request with optional parameter "environment_txt" with value "Emulator" via the REST API
When the client sends file "sim.xml" via the REST API
Then the REST result "ok" is "1"
And I should be able to view the latest created report
Then I should see "Hardware: N900"
@pyykkis
pyykkis / git guide
Created April 12, 2011 20:04
Guide for git branches, remotes and merge requests
# clone your fork of qa-reports from gitorious
git clone [email protected]:~shaofengtang/meego-quality-assurance/release-version-qa-reports.git
# create a branch to follow upstream, i.e., qa-reports/master
git checkout -b upstream
# configure upstream repository in order to pull in new changes easily
git remote add upstream git://gitorious.org/meego-quality-assurance/qa-reports.git
git pull upstream master
We couldn’t find that file to show.
@pyykkis
pyykkis / foo.sh
Created April 4, 2011 06:44
Jenkins cucumber step
#!/bin/bash -le
rvm use ree
# Run integration tests
export DISPLAY=:99
/etc/init.d/xvfb start
RAILS_ENV=test rake cucumber:ci
RESULT=$?
@pyykkis
pyykkis / code.js
Created April 1, 2011 06:41 — forked from thiagofm/code.js
var mongoose = require('mongoose');
var db = mongoose.connect('mongodb://localhost/mydb');
var Schema = mongoose.Schema;
var Posts = new Schema({
name : String,
subject: String,
comment : String,
password: String,
});