Skip to content

Instantly share code, notes, and snippets.

class CrazyLoader(classHandler: ClassHandler) extends RobolectricClassLoader(classHandler) {
override def loadClass(name: String): Class[_] = {
if(name.contains("BaseShimRunner")) {
getParent.loadClass(name)
} else {
super.loadClass(name)
}
}
}
package com.wtfware.disperse
import org.specs2.mutable._
import providers.BigWidgetProvider
import org.specs2.mock.Mockito
import android.content.Context
import android.appwidget.AppWidgetManager
import org.mockito.Matchers.{anyInt, argThat, eq => isEq }
import test.runner.RoboRunner
import android.widget.RemoteViews
package com.wtfware.disperse.test.runner
import org.specs2.mutable.Specification
import com.xtremelabs.robolectric.bytecode.{ShadowWrangler, RobolectricClassLoader}
import android.net.Uri__FromAndroid
import com.xtremelabs.robolectric.internal.RealObject
import android.R
import com.xtremelabs.robolectric.shadows.ShadowApplication
import com.xtremelabs.robolectric.{ApplicationResolver, Robolectric, RobolectricConfig}
import com.xtremelabs.robolectric.res.ResourceLoader
@jbrechtel
jbrechtel / statement_delimiter.patch
Created June 7, 2011 23:43
Add statement delimiter before update
Index: src/Net.Sf.Dbdeploy/Database/DatabaseSchemaVersionManager.cs
===================================================================
--- src/Net.Sf.Dbdeploy/Database/DatabaseSchemaVersionManager.cs (revision 49)
+++ src/Net.Sf.Dbdeploy/Database/DatabaseSchemaVersionManager.cs (working copy)
@@ -120,6 +120,7 @@
{
StringBuilder builder = new StringBuilder();
+ builder.AppendLine(DbmsSyntax.GenerateStatementDelimiter());
builder.AppendLine("UPDATE " + TableName + " SET complete_dt = "
@jbrechtel
jbrechtel / timestamps.patch
Created June 7, 2011 23:44
change_id_to_int64_to_support_timestamp_migration_numbers
Index: scripts/createSchemaVersionTable.mssql.sql
===================================================================
--- scripts/createSchemaVersionTable.mssql.sql (revision 49)
+++ scripts/createSchemaVersionTable.mssql.sql (working copy)
@@ -2,7 +2,7 @@
GO
CREATE TABLE changelog (
- change_number INTEGER NOT NULL,
+ change_number BIGINT NOT NULL,
@jbrechtel
jbrechtel / tmux.conf
Created June 8, 2011 19:11
sls's tmux.conf
# Set prefix command to Control-\
unbind-key C-b
set -g prefix C-\
# C-\ C-\ jumps to the last open window
bind-key C-\ last-window
# C-\ C-\ cycles among panes
# bind C-\ select-pane -t :.+
@jbrechtel
jbrechtel / gist:1021563
Created June 12, 2011 13:43
android intent filter example
<activity android:label="@string/app_name" android:name=".activities.GameActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="android.nevercertain.com" android:scheme="http" android:port="8000" android:pathPrefix="/game"/>
@jbrechtel
jbrechtel / gist:1021573
Created June 12, 2011 14:03
telephone game styles
<resources>
<style name="fill">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
</style>
<style name="wrap">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
import java.io.{FileOutputStream, BufferedWriter, OutputStreamWriter}
trait Logging {
def log(msg: String) {
val writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("/tmp/scant_proc.log", true)))
writer.write(msg)
writer.write("\n")
writer.flush()
writer.close()
}
import org.specs2.mutable.Specification
class PathfinderSpecs extends Specification {
val easyMap = """
.....
.....
.....
.....
.....
.....