Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'pp'
require 'set'
require 'test/unit'
$heights = %w(T S)
$colors = %w(D F)
$looks = %w(H U)
$people = %w(Adam Bond Cruz Dumbo)
#!/usr/bin/env ruby
require 'fileutils'
require 'find'
# FOR THE RECORD: I strongly dislike branch based development
# FOR THE RECORD: I strongly dislike branch based development
# FOR THE RECORD: I strongly dislike branch based development
# FOR THE RECORD: I prefer trunk based development, and branch by abstraction
#!/bin/bash
# Modified by: jwolter/paul: this is based on teh file located at http://www.yolinux.com/TUTORIALS/src/svndiffwrapper.txt
# modified to only work with beyond compare
# Return an errorcode of 0 on successful merge, 1 if unresolved conflicts
# remain in the result. Any other errorcode will be treated as fatal.
# Author: Michael Bradley
#NOTE: all output must be redirected to stderr with "1>&2" as all stdout output is written to the output file
#!/bin/bash
set -e
env=$1
user=somebody
case $env in
# with help from http://serverfault.com/questions/70482/how-can-i-remotely-log-on-to-a-machine-execute-a-script-which-sets-up-an-environ
machine01)
dir=/opt/tomcat/servers/env-a-1/webapps/foo/
// ==UserScript==
// @name escape_to_close_window
// @namespace Users
// @include http://www.quickmandarin.com/chinesepinyintable/
// ==/UserScript==
// Any key you press will close the modal for pronounciation
function closeModal() {
unsafeWindow.hideShutter()
#!/usr/bin/env ruby
# http://projecteuler.net/index.php?section=problems&id=1
# 2010-01-26
def sums(n)
s, i, p = 0, 0, 0
while (p < 1000) do
p = n*i
i += 1
s += p
@jawspeak
jawspeak / EnvTest.java
Created April 19, 2010 22:22
print out env variables in IDEA on mac
package com.jawspeak;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@jawspeak
jawspeak / make.sh
Created May 14, 2010 16:57
make.sh maven wrapper
#!/usr/bin/env bash
# make.sh script to build maven
path=$(cd ${0%/*} && pwd -P)
. $path/mvnopts
# contents of mvnopts:
# export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
usage()
{
@jawspeak
jawspeak / CachingByTypeBeanFactory.java
Created June 26, 2010 02:02
spring CachingByTypeBeanFactory to cache lookups by type
package com.example.spring;
import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@jawspeak
jawspeak / Example Use Google Collections.java
Created July 1, 2010 01:52
java google collections functional programming style
// Use functional programming idioms that google collections (now called google guava) give you.
// Given:
private static final Set<String> CLEARABLE_PATHS = Sets.newHashSet("/app/search", "/app/logout");
// Don't be iterative:
// BAD
private boolean shouldClearCookie() {
for (Iterator<String> stringIterator = CLEARABLE_PATHS.iterator(); stringIterator.hasNext();) {
String clearablePath = stringIterator.next();