Skip to content

Instantly share code, notes, and snippets.

View sroccaserra's full-sized avatar
🐿️

Sébastien Roccaserra sroccaserra

🐿️
View GitHub Profile
@sroccaserra
sroccaserra / simpleTimeUpdatedPoint.elm
Last active August 29, 2015 14:16
Simple time updated point, try it here: http://elm-lang.org/try
import Graphics.Element exposing (Element, show)
import Signal exposing (Signal, map, foldp)
import Time exposing (fps)
type alias Point = {x: Float, y: Float}
main : Signal Element
main =
map show <| foldp update {x=0, y=0} (fps 30)
@sroccaserra
sroccaserra / bouncingCircle.elm
Last active August 29, 2015 14:16
Bouncing circle in Elm, try it here: http://elm-lang.org/try
import Color exposing (red)
import Graphics.Collage exposing (circle, collage, Form, filled, move)
import Graphics.Element exposing (Element)
import List exposing (repeat)
import Signal exposing (Signal, (<~), foldp)
import Time exposing (fps)
w : Float
w = 500
h : Float
@sroccaserra
sroccaserra / fizzbuzzoid.rkt
Last active December 21, 2016 21:38
Fizzbuzz x Monoïd
(require rackunit)
;;;
;; Problème avec notre définition actuelle :
(check-equal? (plus "fizz" 1) ;; définition de 'plus pour "fizz"
4)
(check-equal? (plus 8 1) ;; résultat qui donne "fizz"
"fizz")
@sroccaserra
sroccaserra / fizzbuzzoid.elm
Last active August 29, 2015 14:17
Fizzbuzz x Modoid x Elm
{-- Fizzbuzz sur un monoïde -----------------------
Ensemble : le sous-ensemble de Integerzz des éléments pour lesquels "fizzbuzz" est l'indentité.
Loi de composition interne : la fonction "pluzz".
Élément neutre : ("fizzbuzz", 0)
-----------------------------------------------------------}
import Graphics.Element exposing (..)
@sroccaserra
sroccaserra / Java8JavaTimeUnitTest.java
Created May 27, 2015 14:52
Exploration de Java 8 java.time
package com.scratch.test;
import org.junit.Test;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.TimeZone;
@sroccaserra
sroccaserra / curl-format.txt
Last active January 11, 2016 16:19
Curl format
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
const boom = require('boom')
const productProvider = require('./services/product-provider')
function getProducts(request, reply) {
productProvider.findAll((err, products) => {
if (err) {
return reply(boom.internal("Something happened!", err))
}
reply(products)
@sroccaserra
sroccaserra / testAuth.sh
Created May 26, 2016 08:53
Script to understand OAuth2 Authorization Code flow with httpie (use it to understand only, not to test: don't test this manually)
#!/usr/bin/env bash
while [[ $# > 1 ]]
do
key="$1"
case $key in
-c|--code)
CODE="$2"
shift
@sroccaserra
sroccaserra / RestoringATmuxSessionThatHasStoppedShowingInput.md
Created July 20, 2016 14:28
Restoring a tmux session that has stopped showing input

Restoring a tmux session that has stopped showing input (and restoring user sanity in the process):

$ stty sane

Source:

storage.makeId('dress')
.then(a => storage.makeId('dress').then(b => [a, b]))
.then(([a, b]) => storage.makeId('dress').then(c => [a, b, c]))
.then(([a, b, c]) => {
a.should.be.lessThan(b);
a.should.be.lessThan(c);
b.should.be.lessThan(c);
})