Skip to content

Instantly share code, notes, and snippets.

View founddrama's full-sized avatar
🗺️
time zone chauvinist

Rob Friesel founddrama

🗺️
time zone chauvinist
View GitHub Profile
@founddrama
founddrama / .gitconfig
Created February 15, 2011 01:46
Extracting the latest version in a `0.0.0.0` formatted versioning scheme.
# add the following under `[alias]`
latest-tag = "!sh -c 'git tag | get_latest_version.rb' -"
recent-tags = "!sh -c 'git tag | get_latest_version.rb -c ${1}' -"
@founddrama
founddrama / gist:830921
Created February 17, 2011 03:40
Some sample code for setting the Terminal title which didn't work; and one that did.
# did not actually work
alias mycd="cd /path/to/directory/of/interest;
osascript ~/Library/Scripts/set-terminal-tab-title.scpt
`pwd | cut -d'/' -f5`;"
@founddrama
founddrama / faking-static-methods.js
Created February 17, 2011 03:45
Code for "faking it" blog post re: static methods in JavaScript.
// the "usual" way...
// (1a) init your class and assign to a variable:
var myWidget = new net.fd.SomeWidget();
// now we have our instance
// (1b) call the method from your instance:
myWidget.inspectContext();
// ...except inspectContext() tells returns false
// meaning that we created myWidget for nothing
@founddrama
founddrama / gist:831548
Created February 17, 2011 11:38
Sample code for "launchd to the rescue"
sudo chown -Rv rob:admin /configs
@founddrama
founddrama / gist:831552
Created February 17, 2011 11:41
Sample code for "Automater still a little lacking"
set home to (path to home folder as string)
tell application "Finder"
    if home & "Desktop:4Uploadr" exists then
        return true
    else
        make folder at desktop with properties {name:"4Uploadr"}
    end if
end tell
@founddrama
founddrama / gist:831561
Created February 17, 2011 11:45
Sample code for "a note about Java and OS X 10.6"
cd /tmp/
wget http://www.cs.washington.edu/homes/isdal/snow_leopard_workaround/java.1.5.0-leopard.tar.gz
tar -xvzf java.1.5.0-leopard.tar.gz
sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard
cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0
@founddrama
founddrama / gist:831674
Created February 17, 2011 12:57
Code samples for "an annotated guide to the Google JavaScript Style Guide"
// mutliple vars on multiple lines:
var a = "alpha";
var b = "beta";
var c = "chi";
// vs. comma-separating the declarations:
var a = "alpha", b = "beta", c = "chi";
// vs. comma-separating across multiple lines:
var a = "alpha",
@founddrama
founddrama / disk-space-shaving.sh
Created February 17, 2011 13:00
for "disk space shaving"
for item in *;
do
zip -m "${item}.zip" "${item}";
done
@founddrama
founddrama / gist:831688
Created February 17, 2011 13:02
Paraphrasing Zakas' proposed `scriptgroup` tag example.
<scriptgroup id="group1" ordered="true">
<script src="foo.js"></script>
<script src="bar.js"></script>
<script>
somethingInline();
</script>
</scriptgroup>
@founddrama
founddrama / pedantic-fibonacci.js
Created April 13, 2011 10:49
A minor correction to Angus Croll's Fibonacci generator (as illustrative of the comma operator).
/**
* Apologies to Angus Croll; re:
* http://javascriptweblog.wordpress.com/2011/04/04/the-javascript-comma-operator/
*/
// Yes, I am being a pedantic jerk, but:
var r = [1], n = 0, a = 0, b, next;
function nextFibonacci(){