Skip to content

Instantly share code, notes, and snippets.

@abscondment
abscondment / alphanumerics.clj
Created December 20, 2011 00:58
Monkeying around with numbers.
(ns alphanumerics)
(use 'clojure.math.numeric-tower)
(defn to-alphabet [number alphabet-str]
(let [alpha (vec alphabet-str)
base (count alpha)]
(loop [result (list)
quotient number]
(if (zero? quotient)
(if (empty? result) "0"
import java.io.InputStream
import java.io.InputStreamReader
import java.io.IOException
class Test
# take an InputStream, return a String
def inputstream_to_string(is:InputStream)
buffer = char[0x10000]
out = StringBuilder.new
inreader = InputStreamReader.new(is, "UTF-8")
@abscondment
abscondment / fallacy.md
Created November 15, 2011 23:58
Spot the Fallacy

Spot the Fallacy

From the Rails core mailing list:

> But point releases (e.g. 3.1.x) don't add features or change too much code, they just try to have bugfixes. Bugs are fixed by adding a failing test and making it pass, while ensuring the rest of the test suite passes too. This means each point release has less bugs than the previous one. Upgrading to the newest bugfix release is quick, safe, and should be done as often as possible.

// Generated from Test.mirah
public class Test extends java.lang.Object {
public static void main(java.lang.String[] argv) {
new Test();
}
public java.lang.String baz_method() {
return "baz";
}
public Test() {
java.lang.String bar = null;
#!/bin/sh
cd $HOME/code/jruby
ant clean
ant jar-complete
cd $HOME/code/bitescript
rvm use system
yes | $HOME/code/jruby/bin/jruby -S gem uninstall bitescript
$HOME/code/jruby/bin/jruby -S gem build bitescript.gemspec
@abscondment
abscondment / gist:1099761
Created July 22, 2011 16:16
phash notes
# ruby-1.9.2-p180 :001 > require 'mini_magick'
# => true
# ruby-1.9.2-p180 :002 > i = MiniMagick::Image.open('sample.jpg')
# => #<MiniMagick::Image:0x000000015bc448 @path="/tmp/mini_magick20110721-11512-ru54lb.jpg", @tempfile=#<File:/tmp/mini_magick20110721-11512-ru54lb.jpg (closed)>>
# ruby-1.9.2-p180 :003 > i.resize '8x8'
# => ""
# ruby-1.9.2-p180 :004 > i.type 'Grayscale'
# => ""
# ruby-1.9.2-p180 :005 > i.write 'out.jpg'
vagrant@dev:/vagrant/server$ gem -v
1.8.3
vagrant@dev:/vagrant/server$ bundle -v
Bundler version 1.0.13
vagrant@dev:/vagrant/server$ bundle install
Fetching https://github.com/mongoid/mongoid.git
remote: Counting objects: 26697, done.
remote: Compressing objects: 100% (10246/10246), done.
remote: Total 26697 (delta 16810), reused 24542 (delta 14889)
Receiving objects: 100% (26697/26697), 3.25 MiB | 691 KiB/s, done.

Mirah for Android Development

Mirah is a new JVM language that offers Ruby-like syntax, type inference, closures, metaprogramming, and macros. It lets you write expressive code without the penalty of requiring its own runtime environment. As such, it is very well-suited for platforms in which introducing additional runtimes would be impractical; to wit, Android devices.

This talk will introduce using Mirah for Android development by way of

Mirah for Android Development

Mirah is a new JVM language that offers Ruby-like syntax, type inference, closures, metaprogramming, and macros. It lets you write expressive code without the penalty of requiring its own runtime environment. As such, it is very well-suited for tareting platforms in which introducing additional runtimes would be impractical; to wit, Android devices.

This talk will introduce using Mirah for Android development by way of

Mirah for Android Development

Mirah is a new JVM language that features Ruby-like syntax, metaprogramming, and macros. It lets you write expressive code without the penalty of requiring a runtime environment. As such, it is very well-suited for tareting platforms in which runtimes are impractical; to wit, mobile phones.

This talk will introduce using Mirah for Android development by way of the following topics: