Skip to content

Instantly share code, notes, and snippets.

View searls's full-sized avatar
💚

Justin Searls searls

💚
View GitHub Profile
#I highly recommend experimental gitx: http://brotherbard.com/blog/
#initial setup
git config --global core.autocrlf true
git svn clone -s https://path/to/repo cilp
cd cilp
git svn fetch
git svn show-ignore >> .git/info/exclude
#creating a branch to work on a feature for a production branch
$ bundle exec cucumber
Feature: User posts to their blog
In order post to my blog while I'm travelling
As an author
I want to publish posts from my iPhone
Background: # features/example.feature:6
Given "Specs.xcodeproj" is loaded in the iphone simulator # iCuke-0.6.3/lib/icuke/cucumber.rb:197
execution expired (Timeout::Error)
/Volumes/HD/Users/justin/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/timeout.rb:64:in `launch'
@searls
searls / sample.js
Created February 8, 2011 14:24
testing your jQuery binding in jasmine
(function($){
me = me || {};
$.extend(me,{
bind: function(){
$('body').delegate('a.modal','click',me.openModal)
},
openModal: function(){
var $link = $(this);
//...
}
package blerg;
import static org.apache.commons.lang.StringUtils.*;
import java.util.List;
import java.util.Scanner;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@searls
searls / AddressInputQueue.java
Created March 10, 2011 14:41
An example of stubbing with Mockito (with TestNG)
package com.pillartechnology.mail;
public class AddressInputQueue {
public String next() {
return null; //TODO: not implemented yet.
}
}
@searls
searls / ExternalMailSystem.java
Created March 10, 2011 14:57
An example of behavior verification with Mockito (on TestNG)
package com.pillartechnology.mail;
public interface ExternalMailSystem {
public void send(String domain, String user, String body);
public void send(Email email);
}
@searls
searls / Email.java
Created March 10, 2011 15:12
An example of behavior verification + argument capture with Mockito (on TestNG)
package com.pillartechnology.mail;
import java.util.Date;
public class Email {
private String domain;
private String user;
private String body;
@searls
searls / Email.java
Created March 10, 2011 15:34
An example of stub, verify, and captor with Mockito (on TestNG)
package com.pillartechnology.mail;
import java.util.Date;
public class Email {
private String domain;
private String user;
private String body;
private Date timestamp;
Feature: halt the build when a spec failure occurs
In order to prevent unstable builds from finishing
I want the maven build to terminate in failure when specs fail
Scenario: project with a single failure # features/halt_on_failure.feature:6
Given I am currently in the "jasmine-webapp-single-failing" project # features/step_definitions/mvn_steps.rb:1
When I run "mvn clean test" # features/step_definitions/mvn_steps.rb:6
Then the build should fail # features/step_definitions/mvn_steps.rb:10
And I should see "Results: 5 specs, 1 failure" # features/step_definitions/mvn_steps.rb:18

Maintaining ease of upgrades when customizing proprietary software

This repository is for a project charged with customizing some proprietary vendor's (relatively non-volatile) codebase, but also providing a safe and straightforward way of surviving and integrating future vendor-provided patches and point-releases. A graph describing the approach:

      B-C-D-E------------o---H-I-J-----------o ("develop")
     /                  /|                  / \    
    /      F+B'+C'+D'+E' |         o+H'+I'+J'  \ (local rebase branches)
   /       |             |         |            \ 
  /        |             o---------o-------------o  ("vendor-develop-integration")                

/ | /