Skip to content

Instantly share code, notes, and snippets.

View Endeios's full-sized avatar
🦁

Bruno Veronesi Endeios

🦁
View GitHub Profile
@Endeios
Endeios / malattia wasplabbiana
Created February 1, 2013 09:57
malattia wasplabbiana
k = [8,10,4,0]
console.log(k)
d = _(k).map(function(el,index,list){if(0==index) return 0; else return _(list.slice(0,index)).foldr(function(x,y){return x+ y})})
console.log(d)
_(d).map(function(el,index,list){return list[index+1]-el}).slice(0,this.length-1)
@Endeios
Endeios / relative to total total to relative.scala
Last active December 12, 2015 01:28
malattia wasplabbiana 2 reimplemented in scala, just for my fun
package org.endeios.scala
import org.endeios.scala.mypack.AClass
import java.lang.Exception;
object BigApplication extends App {
//case classes are usefull for printing in console!!
case class MyEl(val data: Int, var Total: Int);
def a = MyEl(8, 0);
@Endeios
Endeios / fromTotalToPartail.js
Last active December 14, 2015 11:39
strange javascript
/*
* http://www.drdobbs.com/open-source/currying-and-partial-functions-in-javasc/231001821?pgno=2
* here because i like it
* this script requires underscore
* http://underscorejs.org/
* */
function schonfinkelize(fn) {
var slice = Array.prototype.slice, stored_args = slice.call(arguments, 1);
return function() {
var new_args = slice.call(arguments), args = stored_args
@Endeios
Endeios / MyTaskListener.java
Last active December 15, 2015 20:29
Context aware Activiti TaskListener
package org.endeios.listeners;
import java.util.Map;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.impl.context.Context;
public class MyTaskListener implements TaskListener {
@Endeios
Endeios / testEvent
Created August 15, 2013 17:04
event single subscriber
import 'dart:html';
import 'package:web_ui/web_ui.dart';
import 'dart:async';
// initial value for click-counter
int startingCount = 5;
/**
* Learn about the Web UI package by visiting
* http://www.dartlang.org/articles/dart-web-components/.
@Endeios
Endeios / Pamm
Created October 10, 2013 14:30
Problem at Pamm laboratories Datum: -- For every sample i can create multiple plates -- On any plate i can identify a number of kind of colonies (hopefully no more that 3, that would mean it is a contaminated sample) E.g. 1:[cleabsiella,coli] 2:[] 3:[enterococco] Problem: Find the full covering, minimizing the number of plates Solution: simple e…
/*STUDIO FOR GROOVY*/
def orderListExcluding(List<Map> aList,List exclusions){
return aList.sort{it["robe"].minus(exclusions).size()}.reverse()
}
a = ["id":3784923874,"robe":["coli","clebsiella"]]
b = ["id":371231923874,"robe":["coli"]]
c = ["id":3712586923874,"robe":[]]
@Endeios
Endeios / client
Created November 25, 2013 16:41
some functions in python for a simple multithreaded client,server
import socket
import futures
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG)
def loltest(ronfz):
@Endeios
Endeios / blueprint.xml
Last active January 1, 2016 14:29
Blueprint (a.k.a Dark PINT) file, with schema location, for editors that support autocompletion and pom with ready to copy/paste maven plugin to maker bundles with aQute bnd tools. in the pom is crucial the <extensions>true</extensions>, in order to activate the bundle packaging extension
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd ">
<!-- An empty blueprint descriptor -->
</blueprint>
@Endeios
Endeios / Option.scala
Last active January 3, 2016 21:19
Chap 4
package chap4
sealed trait Option[+A] {
def map[B](f: A => B): Option[B] = this match {
case None => None
case Some(a) => Some(f(a))
}
def flatMap[B](f: A => Option[B]): Option[B] = this match {
case None => None
@Endeios
Endeios / Zerver
Created February 18, 2014 13:25
Scala Server
package propBased
import java.net.ServerSocket
import java.io.BufferedReader
import java.net.Socket
import java.io.InputStreamReader
import java.io.Writer
import java.io.Reader
import java.io.PrintWriter