Skip to content

Instantly share code, notes, and snippets.

@calo81
calo81 / pair_twtter_simple.md
Last active December 2, 2019 10:04
simplified twitter excercise

Objective:

  • We want to see your coding and pairing practices.
  • Imagine this is a ral world example. So use your usual practices

given this:

{
 id: 1,
@calo81
calo81 / tmux.conf
Last active September 15, 2015 13:01
set-option -g default-command "reattach-to-user-namespace -l bash"
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
unbind p
bind p run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
@calo81
calo81 / gist:562b5c412c713a11b111
Created January 23, 2015 17:26
Testing a feature file from another feature in Turnip - Rspec
# Whi I did this
# Recently I had a scenario where I needed to run a test int two different contexts, mutually exclusive and with different step implementations.
# These exclusion of tests was achieved through using Tags. And this feature needed to exclusive tags.
# I didn't want to duplicate the feature file. So I created one feature file with one of the Tags that invoked the scenarios in the other.
include Turnip::RSpec::Execute
steps_for :tests_1 do
step "feature file :feature_file" do |feature_file|
@calo81
calo81 / gist:6570855
Created September 15, 2013 13:41
Hadoop example bash script for running it (copied from the hadoop mongo project)
#!/bin/sh
###########Environment settings#############
# Modify these to match your setup.
export HADOOP_HOME="/Users/mike/hadoop/hadoop-1.1.2"
INPUT_URI="mongodb://localhost:27017/mongo_hadoop.yield_historical.in"
OUTPUT_URI="mongodb://localhost:27017/demo.yield_historical.out"
JARNAME="treasury-example_1.1.2-1.1.0.jar"
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@calo81
calo81 / ActiveRecord MySQL log sqls
Created August 14, 2012 12:45
monkeypatch activerecord execution of SQLs to log them out
$number_of_executed_sqls = 0
$file = File.open('/tmp/sql.sql', 'w')
module ActiveRecord
module ConnectionAdapters
class MysqlAdapter
def execute(sql, name = nil)
$number_of_executed_sqls += 1 if sql != 'BEGIN' and sql != 'COMMIT'
$file.puts sql + ";"
$file.flush
if name == :skip_logging
@calo81
calo81 / LoggerFilter
Created March 18, 2012 12:48
Filter for reading and logging HttpServletRequest body, and resetting the input stream
package com.paddypower.financials.market.management.rest.logging;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@calo81
calo81 / maven-cucumber-different-app-profile.xml
Created January 16, 2012 11:42
MAVEN:CUCUMBER Maven profile for an application that runs cucumber test with JRuby. deploying a different WAR file, starting the Jetty server and running the cucumber against that one deployed application. Then stopping the server
<profile>
<id>cucumber</id>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>