Skip to content

Instantly share code, notes, and snippets.

View ojacquemart's full-sized avatar

Olivier Jacquemart ojacquemart

View GitHub Profile
@staltz
staltz / introrx.md
Last active November 19, 2025 07:55
The introduction to Reactive Programming you've been missing
@gsoltis
gsoltis / RxFirebase.java
Last active May 6, 2024 03:16
RxJava Bindings for Firebase
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
@fsarradin
fsarradin / WebMain.java
Last active December 12, 2015 03:48
Two ways to create a basic Web application from scratch with route management (in Scala and in Java 8)
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.net.InetSocketAddress;
public class WebMain {
public static void main(String[] args) throws IOException {
WebServer.serve(8080, "/").withRoute(
object Money {
// Equation: x = 1*foo + 7*bar + 11*qix + 21*bar
val FOO = 1; val BAR = 7; val QIX = 11; val BAZ = 21;
def change(cents: Int): List[Map[String, Int]] = {
lazy val tuple = for (
foo <- 0 to cents; bar <- 0 to (cents - FOO * foo) / BAR;
qix <- 0 to (cents - FOO * foo - BAR * bar) / QIX;
baz <- 0 to (cents - FOO * foo - BAR * bar - QIX * qix) / BAZ
) yield (foo, bar, qix, baz)
Stream(tuple: _*)
@loicdescotte
loicdescotte / Forcomptran.md
Last active November 12, 2025 15:54
Scala for comprehension translation helper

Scala for comprehension translation helper

"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.

yield keyword is used to aggregate values in the resulting structure.

This composition can be used on any type implementing this methods, like List, Option, Try, Future...

@xcambar
xcambar / LICENSE
Last active November 20, 2015 12:57
Authenticated routing using AngularJS
Copyright (c) 2015 - Xavier Cambar <@ xcambar_gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@loicdescotte
loicdescotte / iteratees_humains.md
Last active October 10, 2015 17:47
Play2 : Les Iteratees expliqués aux humains... francophones!

#Play2 : Les Iteratees expliqués aux humains... francophones!

Disclaimer : Ce qui suit est la traduction d'un article anglophone paru sur le blog mandubian.com

Vous pouvez retrouver l'article original ici

Vous avez probablement remarqué une nouvelle fonctionnalité intrigante de Play2 nommée Iteratee (ainsi que ses compagnons Enumerators et Enumeratee). Le but de cet article est d'essayer de rendre le concept d'Iteratee compréhensible pour le plus grand nombre avec des arguments simples, en évitant l'approche mathématique / fonctionnelle.

Cet article ne prétend pas tout expliquer à propos des Iteratee / Enumerator / Enumeratee mais traite plutôt les idées qui se cachent derrière.

@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@pheuter
pheuter / gist:3515945
Created August 29, 2012 17:33
Handlebars.js equality check in #if conditional

Handlebars.js is a template framework for Javascript environments. It allows the construction of HTML elements using HTML and expressions wrapped in {{ }}

Limitations of {{if}}

One of the conditional block helpers Handlebars offers is the {{#if}}.

For example:

<div class="entry">
@kddawson
kddawson / markup.html
Created August 15, 2012 13:06
A CSS3 nav ribbon sans images
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Multicelldesign CSS Ribbon</title>
<!-- Don't forget to add an HTML5 polyfill for IE -->
</head>
<body>
<div class="wrapper">
<nav role="navigation" aria-label="main menu">