Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am taraxe on github.
  • I am taraxe (https://keybase.io/taraxe) on keybase.
  • I have a public key ASCQZ0WD0oAQUkFr-eMTZvqKbE7933W8AGgyO4rN1Bagfwo

To claim this, I am signing this object:

@taraxe
taraxe / workbook2.py
Created May 5, 2017 16:00
Doctolib scrapper
import requests
from bs4 import BeautifulSoup
import json
_cache = {}
def _parse_html(html):
soup = BeautifulSoup(html, 'html.parser')
out = []
@taraxe
taraxe / santa.scala
Last active January 20, 2017 01:54
Secret santa
import shapeless.syntax.std.tuple._
import scala.util.Random
object Main extends App {
type Person = String
type Couple = (Person, Person)
object Couple {
def matches(a: Couple, b: Couple) = a.toList.forall(m ⇒ b.toList.contains(m))
}
@taraxe
taraxe / tools.md
Last active February 11, 2018 09:26
Swift libs

#Libs# ##General##

  • Alamofire (networking)
  • Moya (networking)
  • Haneke (image)
  • Spring (animation)
  • Permission (permisions support)
  • Tactile (touch support)
  • Whisper (internal notification)
  • Pages (better UIPageController)
@taraxe
taraxe / bash-cheatsheet.sh
Created May 19, 2016 15:10 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
# antoine.labbe@mfglabs.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDvBR40qiUuD/tmjJop+rXXl3+ncOcxL04uLp1LWslt1cnv5S7ejWxyWHF7XF7DRVEzE7gHCoWYN0dGR5d32GYbdKD0SAzjKmvhth5Pk08XgzqKXw1PXWyYo+BFwV+moWvj/yrIPNiziLXamseRxBUMEO45sbnXnTA17G1x1NfDk32eQhsJVT6Y1HGe5jv+isULLDYFsO/Ix2wwNIJrNVUoMH61ZGdzi/Mt82tPGEdX7gmiHP3q7V8h4wV184xszSzoMA+LEdIQPTbe34MgT2Wy5kSwiceOhh6cmTstzTnA7ae2sbaYjSZFUtb9sH0rglLdigiRfzhAe3RQ7cbgYIKKxlWxD48w4O77t/AUVPTzwzYDEjdk9VhE3C2A1hhDnmkhu/H6n+AAFrIIH+g03lKogiP1xEB2YIY00UeVw+bHSYOTkUZEu2zr8nlFz/M6RkzAtnE1pMN90Ox58ZVpR7GMdLnqLEEQ8actYB3++WY1y47AZ45RLA78yW1+m4vQeu0qBKaKX/fw/fqE0tp4C6accV0EZHJ37XSrxg57VjNlm/52vkYXpZeiEgKfpqQGnvC3l0ctHHkoTqJeCkThY9gYxUVOP6mbuLcniT3KxcWetORO55SWTpurivfF+Qlg0CrzMqEnvBiW8MjwQ2038NlTwJrxVKyqSmQgNfbyrSykhw== ala@taraxe.local
trait DBContext extends AppConfig with TestData {
import play.modules.reactivemongo.ReactiveMongoPlugin
import reactivemongo.api.DB
implicit def ec:ExecutionContext // celui injecté est play.api.libs.concurrent.Execution.Implicits.defaultContext
def app = new FakeApplication(additionalConfiguration = conf)
def context[T](block: => T):T = running(TestServer(port, app)){
await(ReactiveMongoPlugin.db(app).drop.flatMap { _ =>
models.User.collection.insert(users)
@taraxe
taraxe / gist:5299487
Created April 3, 2013 08:35
Play2 Scala sampled message stream as EventSource
val (broadcast, channel) = play.api.libs.iteratee.Concurrent.broadcast[JsValue]
def folder(d:Duration):Iteratee[JsValue,(Option[Long], List[JsValue])] = Iteratee.fold2[JsValue,(Option[Long], List[JsValue])]((None:Option[Long], List[JsValue]())){
case ((t,els),e) => {
val now = new Date().getTime
val current = t.getOrElse(now)
val done = now - current >= d.toMillis
Future.successful(((Some(current), e :: els),done))
}
}
@taraxe
taraxe / gist:2429240
Created April 20, 2012 14:49
Foursquare OAuth2 client for Play Framework 2
package play.api.libs.oauth
import java.net.URLEncoder
import play.api.libs.ws._
import play.api.libs.oauth._
import collection.immutable.HashMap
import play.api.mvc._
import play.api.libs.json._
import play.api.mvc.Results._
@taraxe
taraxe / Nicer
Created December 9, 2011 13:06
Promises sync
function seq(array) {
var seed = $.Deferred().resolve([]);
if (!array || array.length == 0) return seed;
else {
return array.reduce(function(state, promise) {
return state.pipe(function(input) {
return promise().pipe(function(i) {
return input.concat(i);
});
});