Skip to content

Instantly share code, notes, and snippets.

object Test {
def main(args: Array[String]): Unit = {
import org.json4s._
import org.json4s.JsonDSL._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization
import org.json4s.native.Serialization.{ read, write, writePretty }
sealed trait Test
case object TestA extends Test
case object TestB extends Test
@felipehummel
felipehummel / curl_new_relic_bug.php
Last active August 29, 2015 13:59
New Relic CURL PHP bug
<?php
/**
* php --version
PHP 5.4.25-1+sury.org~precise+2 (cli) (built: Feb 12 2014 10:45:30)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
**/
$headers = [];
@felipehummel
felipehummel / AnimaErpServiceInterface.php
Last active August 29, 2015 13:57
erp webservice test
<?php
namespace Anima\Core\Services;
interface AnimaErpDataObject {
public function validate();
public function toArray();
}
class AnimaErpPayment implements AnimaErpDataObject
@felipehummel
felipehummel / textrazor.json
Last active December 23, 2015 19:59
textrazor response
{
"response":{
"coarseTopics":[
{
"id":0,
"label":"Business",
"wikiLink":"http://en.wikipedia.org/Category:Business",
"score":1
},
{
// before:
redisBlocking.blpop(Seq("workList", "otherKeyWithWork"), 5 seconds).map(result => {
result.map(_.map({
case (key, work) => println(s"list $key has work : ${work.utf8String}")
}))
})
// after:
<p>Here at SNEAKHYPE, we love trees.  So here&#8217;s a gallery of some of the most beautiful tree photography we&#8217;ve come across.  <span id="more-64403"></span></p>
<p id="source">Source: <a href="http://creativefan.com/50-most-beautiful-tree-photos/" rel="external" target="_blank" rel="external nofollow">creativefan.com</a></p>
<div id="gallery" class="cfx">
<div class="options">
<span>Click an image to see it fullsize</span>
<strong><span>Expand</span> all images</strong>
object MyActor {
val inProgress = metrics.counter("fetching-in-progress") // yammer/coda hales metrics
}
// I have around 25.000 actors of this type running
// runs on my-dispatcher
class MyActor extends Actor {
val id = ...
implicit val ec = context.system.dispatchers.lookup("dispatcher-for-IO-stuff")
scala> trait MyTrait extends (String => Int => Int)
defined trait MyTrait
scala> class X extends MyTrait {
| def apply(x: String)(i: Int): Int = 10
| }
<console>:8: error: class X needs to be abstract, since method apply in trait Function1 of type (v1: String)Int => Int is not defined
(Note that T1 does not match String)
class X extends MyTrait {
package com.busk.stepsgraph
import akka.dispatch.{ ExecutionContext, Promise, Future, Await }
import java.util.concurrent.{ Executors, ExecutorService}
import akka.util.duration._
import collection.mutable.HashMap
object StepsGraph {
def step[R, U](stepname: String, depStep: Step[_, U])(f: U => R): Step[U, R] = {
Step[U, R](stepname, Seq(depStep), f)
name := "Test"
version := "0.1"
scalaVersion := "2.10.0"
resolvers += "Sonatype Repository" at "http://oss.sonatype.org/content/repositories/releases"
libraryDependencies ++= Seq(
"org.scalatra" % "scalatra" % "2.2.0",