Skip to content

Instantly share code, notes, and snippets.

Casey Watson watsoncj

Block or report user

Report or block watsoncj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am watsoncj on github.
  • I am watsoncj (https://keybase.io/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
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
msg=""
if flash.has?(:err) or flash.has?(:ok)
msg<<"<div id='message'>"
if flash.has? :err
msg<<"<div class='err'>#{flash[:err]}</div>"
@watsoncj
watsoncj / sync_music.sh
Created Jul 5, 2011
2-Way Folder Sync with Rsync
View sync_music.sh
#!/bin/sh
LOCAL="$HOME/Music"
REMOTE="10.10.10.10:/home/user/Music"
cd $LOCAL
rsync -vaurP . $REMOTE
rsync -vaurP $REMOTE/ .
@watsoncj
watsoncj / gist:1005449
Created Jun 2, 2011
pre-commit hook to prevent me from accidentally checking in debug code
View gist:1005449
#!/bin/sh
#
# 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
watsoncj / gist:983656
Created May 20, 2011
strange cherry-pick behavior
View gist:983656
$ git show a1e938c -- $RES
commit a1e938c7616dc1b1bbda22f1a0fff3396b86def0
Author: dude <dude@somewhere.com>
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/WatsonResources.properties b/src/java/com/unifocus/watson/resources/WatsonResources.properties
index 08f7623..db41fe3 100644
--- a/src/java/com/unifocus/watson/resources/WatsonResources.properties
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
You can’t perform that action at this time.