Skip to content

Instantly share code, notes, and snippets.

View julienba's full-sized avatar

julien bille julienba

View GitHub Profile
(function() {
(function(values, arg) {
var field, reverse;
field = arg[0];
reverse = arg[1];
return values.sort(function(a, b) {
var _ref;
if (reverse) {
_ref = [b, a], a = _ref[0], b = _ref[1];
}
@julienba
julienba / specs.scala
Created July 22, 2012 18:16 — forked from teamon/specs.scala
Scala specs cheatsheet
// === Basics
a must beMatching(bar)
a must be matching(bar)
a must not be matching(bar) // negation
// === Any object
a must_== b
a must_!= b
@julienba
julienba / 1.sql
Created August 28, 2012 10:41 — forked from guillaumebort/1.sql
Play 2.0/Anorm
# --- !Ups
CREATE TABLE users(
email VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE subjects(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title LONGTEXT NOT NULL,
@julienba
julienba / Article.scala
Created November 7, 2012 14:30 — forked from bmc/Article.scala
One way to do transactions in Play with Anorm
case class Article(...);
object Article {
import DBUtil._
def delete(id: Long): Either[String, Boolean] = {
withTransaction { implicit connection =>
SQL("DELETE FROM comments WHERE article_id = {id}").on("id" -> id).executeUpdate()
SQL("DELETE FROM appusers WHERE id = {id}").on("id" -> id).executeUpdate( )
Right(true)
#!/bin/sh
# make sure we are in the directory containing this script
SCRIPTDIR=`dirname $0`
cd $SCRIPTDIR
PATH="${PATH}:/bin:/sbin"
#
# HOSTCC vs. CC - if a conftest needs to build and execute a test
# binary, like get_uname, then $HOSTCC needs to be used for this
@julienba
julienba / gist:5037309
Last active December 14, 2015 05:40
Redis error
package controllers
import play.api._
import play.api.mvc._
import play.api.cache.Cache
import play.api.Play.current
/**
* [warn] application - could not deserialize key:myobj ex:java.lang.ClassNotFoundException: controllers.Application$Adress

This post inspired me : http://www.krisbuytaert.be/blog/docker-vs-reality-0-1 !

When people say real world, they actually mean the sick, bitter and desperate world they imagined for you.

So how to produce "ahoy:234" with "ahoy:" and [1,2,3] ??

The idea [1] is "a program is composed of severals one-liners", lets try to port this one liner into several popular languages. :)

EuroClojure 2014, Krakow

Fergal Byrne, Clortex: Machine Intelligence based on Jeff Hawkins’ HTM Theory

  • @fergbyrne
  • HTM = Hierarchical Temporal Memory
  • Slides

big data

  • big data is like teenage sex
    • noone knows how to do it
    • everyone thinks everyone else is doing it

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

defmodule JSON do
import String
def parse( content ) do
case parse_content(content) do
{ value, "" } -> value
{ _, _ } -> raise "crap"
end
end