This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'riak' | |
def fill_customers(n=50000) | |
n_threads = 4 | |
ops_thread = n / n_threads | |
threads = [] | |
n_threads.times do |i| | |
threads << Thread.new do | |
client = Riak::Client.new(:host => "10.112.29.130", :port => 8098, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.michelboudreau.alternator.*; | |
import com.amazonaws.AmazonClientException; | |
import com.amazonaws.AmazonServiceException; | |
import com.amazonaws.services.dynamodb.AmazonDynamoDB; | |
import com.amazonaws.services.dynamodb.model.*; | |
import java.util.*; | |
public class Main { | |
static private AlternatorDBClient client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
trait Size[A] { | |
def apply(): Int | |
} | |
implicit val shortSize = new Size[Short] { | |
def apply() = 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test(m: Magnet): Int = m.i | |
class Magnet(val i: Int) | |
object Magnet extends LowerPriorityMagnet { | |
implicit def fromUnitWithInt(u: Unit)(implicit i: Int) = new Magnet(i) | |
} | |
abstract class LowerPriorityMagnet { | |
implicit def fromUnitWithString(u: Unit)(implicit s: String) = new Magnet(s.toInt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Bar[In <: HList, Out <: HList] | |
class Foo[T](implicit gen: Generic[T]) { | |
def apply[L <: HList](implicit bar: Bar[L, gen.Repr]) = null | |
} | |
// error: type arguments [L,Foo.this.gen.Repr] do not conform to trait Bar's type parameter bounds [In <: shapeless.HList,Out <: shapeless.HList] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
import shapeless.poly._ | |
import shapeless.ops.hlist._ | |
import scala.util.Try | |
trait Deserializer[A, B] { | |
def apply(t: A): Either[String, B] | |
} | |
object Deserializer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgname=shairport | |
pkgver=1.0 | |
pkgrel=1 | |
pkgdesc="An AirPlay-compatible audio receiver" | |
arch=('i686' 'x86_64' 'armv6h') | |
url="https://github.com/abrasive/shairport" | |
license=('public-domain') | |
depends=('avahi' 'glibc' 'pkgconfig' 'libao' 'openssl') | |
makedepends=('git' 'libao' 'openssl') | |
provides=(shairport) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun smarter-move-beginning-of-line (arg) | |
"Move point back to indentation of beginning of line. | |
Move point to the first non-whitespace character on this line. | |
If point is already there, move to the beginning of the line. | |
Effectively toggle between the first non-whitespace character and | |
the beginning of the line. | |
If ARG is not nil or 1, move forward ARG - 1 lines first. If | |
point reaches the beginning or end of the buffer, stop there." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function invert(move) { | |
switch (move) { | |
case 'up': return 'down'; | |
case 'down': return 'up'; | |
case 'left': return 'right'; | |
case 'right': return 'left'; | |
default: return move; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz.syntax.monad._ | |
import spire.math._ | |
import spire.implicits._ | |
import pfp.Distribution._ | |
// data Outcome = Win | Lose | |
sealed trait Outcome | |
case object Win extends Outcome | |
case object Lose extends Outcome |
OlderNewer