Skip to content

Instantly share code, notes, and snippets.

View dohzya's full-sized avatar

Étienne Vallette d'Osia dohzya

  • EY Fabernovel
  • Paris, France
  • 21:32 (UTC +01:00)
View GitHub Profile
@dohzya
dohzya / method_namespace.rb
Created August 1, 2009 08:14
Example of namespace aware send implementation
class Object
# invoke the method meth of the module mod
def mod_send(mod, meth, *args, &bloc)
if self.is_a? mod
mod.instance_method(meth).bind(self).call(*args, &bloc)
else
method_missing("#{mod}::#{meth}", *args, &bloc)
end
end
end
package main
import (
"net"
"fmt"
"flag"
"log"
)
var listenPort = flag.Int("port", 7331, "port")
@dohzya
dohzya / fortheheroes.sh
Created February 10, 2012 13:59
For the heroes
$'\x65\x63\x68\x6f' $'\x4f\x68\x2c\x20\x73\x6f\x72\x72\x79\x20\x66\x6f\x72\x20\x74\x68\x65\x20\x63\x6f\x6e\x66\x75\x73\x69\x6f\x6e\x2c\x20\x79\x6f\x75\x27\x72\x65\x20\x6e\x6f\x74\x20\x61\x20\x68\x65\x72\x6f\x2c\x20\x79\x6f\x75\x27\x72\x65\x20\x6a\x75\x73\x74\x20\x70\x6c\x61\x69\x6e\x20\x73\x74\x75\x70\x69\x64\x2e'
@dohzya
dohzya / RubyRegexp.scala
Last active October 9, 2015 05:47
Make regexp simple to use
import scala.util.matching.Regex
object RubyRegex {
case class RubyMatcher(rx: Regex) extends AnyVal { // Value Class (no runtime overhead!)
def ===(str: String) = rx.findFirstIn(str).isDefined
}
@dohzya
dohzya / TestEnum.scala
Last active December 10, 2015 22:29
Test de séparation d'un Enumerator (de Play 2) en 2 parties.
package tests
import play.api._
import play.api.libs.concurrent._
import play.api.libs.iteratee._
import scala.concurrent._
import scala.concurrent.ExecutionContext.global
object TestEnum {
@dohzya
dohzya / Application.scala
Last active December 11, 2015 11:48
Exemple of request that silently fail in Play 2.1
package controllers
import play.api._
import play.api.mvc._
object Die {
def potato = "not today"
val iLikeTrain = ???
@dohzya
dohzya / 0. My awesome question.txt
Created January 25, 2013 14:33
PlayByExample: My awesome question
My awesome question
@dohzya
dohzya / Question
Created January 25, 2013 15:49
Exemple
Exemple de question
@dohzya
dohzya / test.html
Created January 25, 2013 15:50
Récupérer la réponse d'un gist sans la question
<html>
<head>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://gist.github.com/4635425.js"></script>
<script>
$(function(){
$(".gist .gist-file").each(function(){
var $file = $(this);
@dohzya
dohzya / 0. Coast to coast.txt
Created January 25, 2013 16:00
PlayByExample: Coast to coast
Coast to coast