Skip to content

Instantly share code, notes, and snippets.

View banshee's full-sized avatar

James Moore banshee

View GitHub Profile
@banshee
banshee / scala ide xml sample
Last active December 31, 2015 21:28
Scala IDE worksheet sample for XML
import scala.xml._
object SampleWorksheet {
// Some simple xml
val xml = """
<cone style="waffle" sprinkles="red">
tasty!!
<scoop size="small" />
<scoop size="large" />
</cone>
@banshee
banshee / gist:7886842
Created December 10, 2013 07:15
Talk for Seattle Scala group
package com.restphone
import scalaz._
import Scalaz._
import scala.concurrent.Future
import scala.concurrent.Future._
import scala.concurrent.Await
import scala.concurrent.duration._
object MonadEvidenceThatWillMakeSenseLater {
type GetList() =
let switchvox_users_voicemail_getList_response = """
</response>"""
le
let switchvox_users_voicemail_getList = """
</request>"""
me
member self.X = switchvox_users_voicemail_getList_response
@banshee
banshee / gist:7775274
Created December 3, 2013 18:53
for fantomas bug report
type GetList() =
let switchvox_users_voicemail_getList_response = """
</response>"""
let switchvox_users_voicemail_getList = """
</request>"""
member self.X = switchvox_users_voicemail_getList_response
@banshee
banshee / gist:7000449
Created October 15, 2013 23:46
Modify the output of swig for use with Xamarin
ARGF.each do |l|
case l
when /public delegate void Exception(Argument)?Delegate/
puts " [MonoTouch.MonoNativeFunctionWrapper]", l
when /static void SetPendingArgument(Null|OutOfRange)?Exception/
puts " [MonoTouch.MonoPInvokeCallback (typeof (ExceptionArgumentDelegate))]", l
when /static void SetPending.*Exception/
puts " [MonoTouch.MonoPInvokeCallback (typeof (ExceptionDelegate))]", l
when /static string CreateString/
puts " [MonoTouch.MonoPInvokeCallback (typeof (SWIGStringDelegate))]", l
@banshee
banshee / gist:5565772
Created May 13, 2013 02:09
F# output
val it : SimpleNode list =
[{name = "val";
ancestors =
[{name = "bar";
ancestors = [{name = "foo";
ancestors = [];
content = null;
attributes = map [("snark", "boojum")];}];
content = null;
attributes = map [];}; {name = "foo";
@banshee
banshee / gist:5544271
Created May 8, 2013 22:48
type provider on monotouch
Given this code:
open FSharp.Data
open System.Xml.Linq
type SomeSample = XmlProvider<"""<author name="Paul Feyerabend" born="1924" />""">
I get:
Error FS3033: The type provider 'ProviderImplementation.XmlProvider' reported an error: Specified argument is neither a file, nor well-formed XML: Could not find a part of the path "/<author name="Paul Feyerabend" born="1924" />". (FS3033) (fslib)
@banshee
banshee / gist:5328177
Created April 6, 2013 23:55
bob and alice for typed channels
package com.restphone
import akka.actor.Actor
import akka.actor.ActorSystem
import com.typesafe.config.ConfigFactory
import akka.channels._
class Message
class Response
@banshee
banshee / gist:5327073
Created April 6, 2013 18:22
presentation compiler log
"wait for more work"(
),
"atnode"(
1,
1365272025636),
"asked"(
),
"wait for more work"(
),
"atnode"(
@banshee
banshee / gist:5326974
Created April 6, 2013 17:56
Phantom errors
package com.restphone
import scala.collection.mutable
import akka.actor.Actor
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.Props
import akka.actor.actorRef2Scala
import akka.actor.ActorSystem
import com.typesafe.config.ConfigFactory