Skip to content

Instantly share code, notes, and snippets.

View banshee's full-sized avatar

James Moore banshee

View GitHub Profile
module FSharpModule
let fn() = 1
type Class1() =
member this.X = "F#"
namespace FSharpNamespace
type Class2 =
| Something
| OtherThing of int
using System;
// Note that "using FSharpModule" (without "static") isn't legal C#.
// An FSharp module gets compiled into a type, and "using" specifically
// imports namespaces.
using static FSharpModule;
using FSharpNamespace;
using static FSharpNamespace.Class2;
#pragma warning disable 219 // no warnings about unused variables
@banshee
banshee / gist:afc1d024849ddc1a0807
Last active February 11, 2016 01:41
shapeless experiments
scala> import shapeless._
import shapeless._
scala> import shapeless.ops.function.FnToProduct
import shapeless.ops.function.FnToProduct
scala>
scala> // a normal function taking a string and returning 42
Script started on Sat Sep 20 11:40:10 2014
[info] Loading global plugins from /Users/james/.sbt/0.13/plugins
[info] Loading project definition from /Users/james/workspace/jstwodelete/project
[info] Updating {file:/Users/james/workspace/jstwodelete/project/}jstwodelete-build...
[info] Resolving default#global-plugins;0.0 ...
M[info] Resolving com.typesafe.sbteclipse#sbteclipse-plugin;2.4.0 ...
M[info] Resolving com.typesafe.sbteclipse#sbteclipse-core;2.4.0 ...
package com.restphone.scalaztalk
import scalaz._
import Scalaz._
object Samples {
val wrapWithParens = (x: String) => s"( $x )" //> wrapWithParens : String => String = <function1>
val wrapWithSquareBrackets = (x: Int) => s"[ $x ]"
//> wrapWithSquareBrackets : Int => String = <function1>
val wrapWithBoth: Int => String = wrapWithParens compose wrapWithSquareBrackets
@banshee
banshee / Topic 2
Created May 17, 2014 23:35
Topic 2
object TopicPlayground extends App {
val t: Topic[String] = scalaz.stream.async.topic()
val sub1 = t.subscribe
val out1 = sub1
.flatMap(x => Process.tell(s"raw value: $x") ++ Process.emitO(x.length))
.runLog
val otherThread = future {
object TopicPlayground extends App {
val t: Topic[String] = scalaz.stream.async.topic()
val sub1 = t.subscribe
val out1 = sub1
.flatMap(x => Process.tell(s"raw value: $x") ++ Process.emitO(x.length))
--------- beginning of /dev/log/main
W/Binder (18423): Caught a RuntimeException from the binder stub implementation.
W/Binder (18423): java.lang.NullPointerException
W/Binder (18423): at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
W/Binder (18423): at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
W/Binder (18423): at android.os.Binder.execTransact(Binder.java:404)
W/Binder (18423): at dalvik.system.NativeStart.run(Native Method)
--------- beginning of /dev/log/system
W/InputMethodManagerService( 446): Got RemoteException sending setActive(false) notification to pid 9109 uid 10165
I/ActivityManager( 446): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=com.amazon.kindle cmp=com.amazon.kindle/.UpgradePage bnds=[454,215][646,407]} from pid 31860
@banshee
banshee / gist:8324977
Last active January 2, 2016 15:39
part of my .gitconfig file
[merge]
summary = true
tool = "p4"
[mergetool "p4"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge \
"$PWD/$BASE" \
"$PWD/$LOCAL" \
"$PWD/$REMOTE" \
"$PWD/$MERGED"