Skip to content

Instantly share code, notes, and snippets.

View darinwilson's full-sized avatar

Darin Wilson darinwilson

View GitHub Profile
@darinwilson
darinwilson / gemdoc.sh
Created November 16, 2014 04:29
Generate and open RDocs for any installed gem
#
# usage: gemdoc GEM_NAME
# eg: gemdoc rspec-mocks
#
gemdoc() {
gem rdoc $1 --rdoc
(cd `gem env gemdir`/doc/$1*; open rdoc/index.html)
}
@darinwilson
darinwilson / rm-android-hash.rb
Last active August 29, 2015 14:13
RubyMotion Android: can't convert java.util.HashMap to Ruby Hash
# Update: there's an issue open in RubyMotion for this, so hopefully it will get resolved soon.
#
# http://hipbyte.myjetbrains.com/youtrack/issue/RM-725
#
# In the meantime, here's a workaround: https://gist.github.com/darinwilson/26c8b573a65d8bc4c64b
# if you create a Ruby Hash...
ruby_hash = { foo: "bar" }
# ...you can call Ruby methods...
ruby_hash.has_key?(:foo)
@darinwilson
darinwilson / HashMapToHash.rb
Last active August 29, 2015 14:13
RubyMotion for Android utility that converts a java.util.HashMap instance to a Ruby hash
# Utility class that converts a java.util.HashMap instance to a Ruby Hash. RubyMotion will
# start supporting this out of the box at some point, but until then, this can be used
# as a workaround: http://hipbyte.myjetbrains.com/youtrack/issue/RM-725
#
# Usage:
# HashMapToHash.convert(hashmap)
#
# This supports nested hashes and should assure that all Java-based values are properly converted
# to their Ruby counterparts (i.e. java.lang.String => String).
#
@darinwilson
darinwilson / main_activity.rb
Last active August 29, 2015 14:18
Trying to open an Android class in RubyMotion
# throws NameError: uninitialized constant `Android'
class Android::App::Activity
def say_hello
puts "hello!"
end
end
class MainActivity < Android::App::Activity
def onCreate(savedInstanceState)
super
@darinwilson
darinwilson / art_crash_output
Created April 29, 2015 17:17
Output of ART crash when instantiating a RoundRect with RubyMotion Android
Start com.yourcompany.round_rect_crash/.MainActivity
--------- beginning of system
--------- beginning of main
I/com/yourcompany/round_rect_crash( 1607): creating RoundRect with Java
I/com/yourcompany/round_rect_crash( 1607): #<android.graphics.drawable.shapes.RoundRectShape:0x100019>
I/com/yourcompany/round_rect_crash( 1607): creating RoundRect with Ruby
E/art ( 1607): 0xb405ce80 SpaceTypeMallocSpace begin=0x12c00000,end=0x12e01000,limit=0x22c00000,size=2MB,capacity=96MB,non_growth_limit_capacity=256MB,name="main rosalloc space"]
E/art ( 1607): 0xb425ff60 allocspace main rosalloc space live-bitmap 3[begin=0x12c00000,end=0x22c00000]
E/art ( 1607): 0xb427f300 allocspace main rosalloc space mark-bitmap 3[begin=0x12c00000,end=0x22c00000]
E/art ( 1607): 0xb4050480 SpaceTypeImageSpace begin=0x6fec0000,end=0x70835000,size=9MB,name="/data/dalvik-cache/x86/system@framework@boot.art"]
@darinwilson
darinwilson / nation_builder_people.rb
Created December 21, 2015 22:29
Exercise using the NationBuilder People API endpoint
#
# This is very rudimentary web app that allows you to create, update, and
# delete a Person record using the NationBuilder API. This covers just the
# basics - many details have been left out.
#
# The app was built in Ruby 2.2.0, using the Sinatra web framework, and the
# NationBuilder API Ruby gem.
#
# To run the app:
# * gem install sinatra
@darinwilson
darinwilson / nation_builder_events.rb
Created December 21, 2015 22:31
Exercise using the NationBuilder Events API
#
# This is very rudimentary web app that allows you to create and update
# an Event record using the NationBuilder API. This covers just the
# basics - many details have been left out.
#
# The app was built in Ruby 2.2.0, using the Sinatra web framework, and the
# NationBuilder API Ruby gem.
#
# To run the app:
# * gem install sinatra
@darinwilson
darinwilson / ep8.exs
Created January 17, 2016 19:28
LearnElixir.tv Episode 8 Exercise
def join(strs, separator) do
last = List.last(strs)
for str <- strs, into: "" do
if str != last do
str <> separator
else
str
end
end
end
@darinwilson
darinwilson / cpu_dreams.txt
Created February 22, 2017 17:23
CPU Dreams - for Sonic Pi
# Source code for a Sonic Pi piece (http://sonic-pi.net/)
#
# This an extension of an earlier piece I wrote with
# Sonic Pi called "Ambient Experiment". I added a new
# voice and routed the notes out via MIDI so that the
# sounds could be generated in Ableton Live.
#
# Audio version: https://soundcloud.com/darinwilson/cpu-dreams
#
# The piece consists of four long loops, each of which

Infinite Red seeks contract Rails engineer

Infinite Red is looking for an experienced Rails engineer for a long-term, full-time contract position. This is a remote position available to U.S. citizens working in any one of the U.S. time zones.

About the job

You'll be working with a small team to support a portfolio of apps that are used internally by a large public university. At times, you'll be working independently, and at other times directly with other engineers. But we always collaborate to share approaches, help each other out, and keep the quality of our repos as high as we can.