Skip to content

Instantly share code, notes, and snippets.

View pauldub's full-sized avatar
🐱
🇫🇷 🇧🇪

Paul pauldub

🐱
🇫🇷 🇧🇪
View GitHub Profile
@pauldub
pauldub / server.sh
Created July 26, 2012 19:29 — forked from ibdknox/server.sh
example daemon for lein processes
#!/bin/bash
name=webnoir
pidfile=/var/run/$name.pid
if [ -f "$pidfile" ]; then
pid=`cat $pidfile`
running=`ps p $pid |wc -l`
if [ $running -eq 1 ]; then
pid=
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@pauldub
pauldub / gist:4715870
Created February 5, 2013 17:04
You can monkey patch the ERB class like this but you will probably get a `warning: already initialized constant`
class ERB
module Util
HTML_ESCAPE = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', "'" => '&#39;' }
end
end
@pauldub
pauldub / gist:5383113
Last active December 16, 2015 05:19
Dart's =>
var fruits = [
'banane',
'mangue',
'orange'
];
// L'operateur => c'est un shorthand pour les fonction de ce genre la si on l'appliquait a du JS
_.filter(fruits, function (fruit) {
return fruit.match(/^b/)
=proc:<0.0.0>
State: Waiting
Name: init
Spawned as: otp_ring0:start/2
Spawned by: []
Started: Wed Mar 12 14:17:11 2014
Message queue length: 0
Number of heap fragments: 0
Heap fragment data: 0
Link list: [<0.3.0>, <0.7.0>, <0.6.0>]
@pauldub
pauldub / client.lua
Last active August 29, 2015 13:57
Luvit dnode examples
local dnode = require('.')
local utils = require('utils')
dnode:connect(7070, function(remote, conn)
print(utils.dump(remote))
remote.zing(33, function(n)
print('n='..n)
end)
remote.greet("welcome", "paul", function(greetings)
-- This is my current thinkings about the main interface provided by the library and
-- there are a few things I am unable to do at the moment.
-- So my problem is about how can I get the function "dnode:connect" and "dnode" callable
-- at the same time. I tried both with tables and functions but without success.
-- Helper tcp connect and listen interface.
local dnode = require('dnode').dnode
-- or, depending on how I get around the problem stated above
local dnode = require('dnode')

Keybase proof

I hereby claim:

  • I am pauldub on github.
  • I am pauldub (https://keybase.io/pauldub) on keybase.
  • I have a public key whose fingerprint is EF09 728F F09C FC4D 8458 CC29 5DDE 8D84 698E 657A

To claim this, I am signing this object:

@pauldub
pauldub / core.clj
Created July 9, 2014 18:35
Sample hydrawm mail reader
(ns mu-reader.core
(:import [org.apache.james.mailbox.maildir MaildirStore])
(:use compojure.core)
(:require [compojure.handler :as handler]
[compojure.route :as route]
[clojure-mail.core :refer :all :as mail]
[clojure-mail.message :as message :refer [safe-get]]
[me.raynes.fs :as fs]
[me.raynes.conch :refer [with-programs]]
[noir.response :as response]))
@pauldub
pauldub / 0_reuse_code.js
Created August 11, 2014 16:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console