Skip to content

Instantly share code, notes, and snippets.

View thillerson's full-sized avatar

Tony Hillerson thillerson

View GitHub Profile
@thillerson
thillerson / segment_problem.scala
Created March 10, 2016 15:45
segment problem
case class RoadSegment(id:Int, segType:String)
case class Leg(begin:RoadSegment, end:Option[RoadSegment])
val segments = Seq(
RoadSegment(1, "D"),
RoadSegment(2, "D"),
RoadSegment(3, "D"),
RoadSegment(4, "W"),
RoadSegment(5, "B"),
RoadSegment(6, "B"),
@thillerson
thillerson / gist:d72a323153f81567ff0c
Created June 4, 2014 21:10
Horrible hack to get Homebrew to work with 10.10 Yosemite
sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0 /System/Library/Frameworks/Ruby.framework/Versions/1.8
@thillerson
thillerson / gist:0eb01e76f4a1cbdcca7d
Created June 4, 2014 17:38
Easy xcode switching for playing with swift
➜ cat .bash_aliases | grep xcode
alias x5="sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer"
alias x6="sudo xcode-select -switch /Applications/Xcode6-Beta.app/Contents/Developer"
➜ x5
➜ xcrun swift
xcrun: error: unable to find utility "swift", not a developer tool or in PATH
➜ x6
➜ xcrun swift
Welcome to Swift! Type :help for assistance.
1>
android.renderscript.RSDriverException: Failed to create RS context.
at android.renderscript.RenderScript.create(RenderScript.java:1176)
at android.renderscript.RenderScript.create(RenderScript.java:1203)
at android.renderscript.RenderScript.create(RenderScript.java:1190)
at com.app.ui.util.BlurTransformation.<init>(BlurTransformation.java:23)
at com.app.ui.menu.MenuFragment.onActivityCreated(MenuFragment.java:51)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1508)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:958)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1097)
@thillerson
thillerson / gist:9749262
Created March 24, 2014 21:10
-1dp dimen robolectric stack trace
java.lang.RuntimeException: error converting -1dp using EnumConverter
at org.robolectric.shadows.Converter.convertAndFill(Converter.java:150)
at org.robolectric.shadows.Converter.convertAndFill(Converter.java:50)
at org.robolectric.shadows.ShadowResources.createTypedArray(ShadowResources.java:228)
at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:203)
at org.robolectric.shadows.ShadowResources.access$000(ShadowResources.java:51)
at org.robolectric.shadows.ShadowResources$ShadowTheme.obtainStyledAttributes(ShadowResources.java:460)
at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java)
at android.content.Context.obtainStyledAttributes(Context.java:362)
at android.view.ViewGroup$MarginLayoutParams.__constructor__(ViewGroup.java:5593)
# assuming a user peeps, who is a sudoer, and has a key set up for the repo in unfuddle.
echo "effectiveui.unfuddle.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0bTJbUZRCwOfGnWEsWYo1DgJushjeEOOpiYH+T7XFdUUDVUy9M63StNlD2L/v8EDNWj6JFq7qaI4alu7fJqV/eSNLBnyG6mQH0ciB1TEYYw/zv8FyKp8tHg7hBacRcaQw7Wyz9B+St9yKRY4IY9/oeJaxOiXZuVK6lmjnnl3NZoLK8XNhN75CnCr9hYVwMrwLUaDNFxv7i5TUOSamXmDAdEft9hoV7rT9tE5V9GMoXM3fP0Jhs/lDFcA37hkAu1oqYYUcULwDdM+nZmLZcMcfSyCtMXEihE7MGOCyb5OEwHAP4lsmxQMA7S684TFUrBYzXNdR1i+ztWR1OFdN1tAYw==" >> ~/.ssh/known_hosts
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
# Pause for a sudo
sudo apt-get update
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget curl ssl-cert git-core rake librspec-ruby libxml-ruby thin couchdb zlib1g-dev libxml2-dev emacs scala
# To upgrade scala:
http://jkyamog.blogspot.com/2010/08/more-on-scala.html
{
"domain": "local",
"deploy_user": {
"name": "tony"
},
"railsapp": {
"name": "ttm-client",
"dir": "/srv/ttm-client",
"db": {
"database": "ttm-client"
{
"domain": "local",
"deploy_user": {
"name": "peeps"
},
"railsapp": {
"name": "peeps",
"dir": "/srv/peeps",
"db": {
"database": "peeps"
require 'rubygems'
require 'uuidtools'
module UUIDasID
#
# When included, e.g. <code>include UUIDasID</code>,
# this method will be called, passing the class in
#
def self.included mod