Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am watsoncj on github.
  • I am watsoncj ( on keybase.
  • I have a public key ASAJ-bCY6ShGYO1yd600p6221NbRvFKsWaWL7Buk-kfGcwo

To claim this, I am signing this object:

View fizzbuzz.clj
#!/usr/bin/env clj
(println "traditional flow control solution to FizzBuzz")
(defn divides
"check if x is divisible by y without remainder"
[x y]
(= (rem x y) 0))
(loop [i 1]
(if (divides i 15)
watsoncj / gist:1525043
Created Dec 27, 2011
Option pattern from FP for Java Developers
View gist:1525043
public final class Some<T> extends Option<T> {
private final T value;
public Some(T value) {
this.value = value;
public boolean hasValue() {
return true;
View gist:1093686
% cat app/helpers/retailer_helper.rb
# Helper methods defined here can be accessed in any controller or view in the application
Cc.helpers do
def messages
if flash.has?(:err) or flash.has?(:ok)
msg<<"<div id='message'>"
if flash.has? :err
msg<<"<div class='err'>#{flash[:err]}</div>"
watsoncj /
Created Jul 5, 2011
2-Way Folder Sync with Rsync
rsync -vaurP . $REMOTE
rsync -vaurP $REMOTE/ .
watsoncj / gist:1005449
Created Jun 2, 2011
pre-commit hook to prevent me from accidentally checking in debug code
View gist:1005449
# This hook prevents you from committing any file containing the
# words "do not commit".
# The idea is that I can add a comment to prevent myself from
# committing a change related to debugging or hacking.
# To enable this hook, rename this file to ".git/hooks/pre-commit".
watsoncj / gist:983656
Created May 20, 2011
strange cherry-pick behavior
View gist:983656
$ git show a1e938c -- $RES
commit a1e938c7616dc1b1bbda22f1a0fff3396b86def0
Author: dude <>
Date: Fri May 20 12:30:59 2011 -0600
WATSON-4352 added screens to configure revenue property data
diff --git a/src/java/com/unifocus/watson/resources/ b/src/java/com/unifocus/watson/resources/
index 08f7623..db41fe3 100644
--- a/src/java/com/unifocus/watson/resources/
View gist:951816
$ gem install eventmachine
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
$ gem install timetrap
View gist:833857
ssh USER@HOST bzip2 -c /path/to/rootfs.bin | bunzip2 -c | dd of=/dev/sda7