Skip to content

Instantly share code, notes, and snippets.

View seralf's full-sized avatar
🎯
Focusing

Alfredo Serafini seralf

🎯
Focusing
View GitHub Profile
@seralf
seralf / gist:4122280
Last active October 13, 2015 02:07
maven compiler settings for java 1.6
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
@seralf
seralf / gist:4187977
Last active October 13, 2015 11:18
A simple class for RDF MIME detection using sesame Rio Parser.
package formats;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.openrdf.rio.RDFFormat;
import org.openrdf.rio.RDFParser;
@seralf
seralf / gist:4431015
Last active December 10, 2015 11:58
small script to compute happy numbers with scala (useful as a funny benchmark for very big max numbers ;-) NOTE: try to replace numbers.map(x => x * x).sum with: numbers.par.map(x => x * x).sum
package happy
/**
* @author seralf
*
* small script to compute happy numbers with scala
* (useful as a funny benchmark for very big max numbers ;-)
*
* NOTE: try to replace
* numbers.map(x => x * x).sum
@seralf
seralf / gist:4543350
Created January 15, 2013 23:59
PingPong Actor with node.js and 'drama' module (inspired by akka)
var drama = require('drama')
var sys = drama('sys')
var Spider = function() {
var i = 0
var me = this.self.pick('ping', 'pong', 'end')
return {
ping : function() {
package EasyJSON
import net.minidev.json.JSONValue
import net.minidev.json.JSONArray
import net.minidev.json.JSONObject
import scala.collection.JavaConversions._
object JSON {
def parseJSON(s: String) = new ScalaJSON(JSONValue.parse(s))
(function($){
$.widget("ui.mywidget", {
options: {
autoOpen: true
},
_create: function(){
// by default, consider this thing closed.
$('.example-twitter-oss .typeahead').typeahead({
name: 'twitter-oss',
prefetch: '../data/repos.json',
template: [
'<p class="repo-language">{{language}}</p>',
'<p class="repo-name">{{name}}</p>',
'<p class="repo-description">{{description}}</p>'
].join(''),
engine: Hogan
});
$('.example-twitter-oss .typeahead').typeahead({
name: 'twitter-oss',
prefetch: '../data/repos.json',
template: [
'<p class="repo-language">{{language}}</p>',
'<p class="repo-name">{{name}}</p>',
'<p class="repo-description">{{description}}</p>'
].join(''),
engine: Hogan
});
# /etc/environment
JAVA_HOME="/usr/lib/jvm/java-7-oracle"
JRE_HOME="/usr/lib/jvm/java-7-oracle/jre"
PATH="...(other path):$JAVA_HOME:$JRE_HOME"
/**
* actor wrapping access for browser socket
*/
class BrowserSocket(
val s: WebSocketConnection,
val userId: Long,
val teamId: Long
) extends Actor {