Skip to content

Instantly share code, notes, and snippets.

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")
<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>
// 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:
@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
},
{
@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 / 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 = [];
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 / TestJava.java
Last active August 29, 2015 14:06
ElasticSearch Scala/Java client SignificantTerms problem
package com.busk.searching;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsBuilder;
import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
{
"results":[{
"articles":[{
"id":131720411,
"created_at":"2014-11-03 18:34:53",
"type":"articles",
"title":"Apucarana: Polícia Militar evita mais quatro golpes do falso sequestro",
"language_code":"pt",
"url":"http://www.tnonline.com.br/noticias/apucarana/45,304044,03,11,apucarana-policia-militar-evita-mais-quatro-golpes-do-falso-sequestro.shtml",
"published_at":"2014-11-03 18:34:18",
// Construtor da classe é (nome: String)
class MinhaClasse(nome: String) {
def olaQuem() = s"Olá $nome!"
}
val minha = new MinhaClasse("Felipe")
val msg = minha.olaQuem()
println(msg) // Olá Felipe!