Skip to content

Instantly share code, notes, and snippets.

View jldupont's full-sized avatar

Jean-Lou Dupont jldupont

View GitHub Profile
@jldupont
jldupont / designer.html
Last active August 29, 2015 14:23
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@jldupont
jldupont / gist:2938824
Created June 15, 2012 21:39
Get basename of list of files
ls *.xml | cut -d . -f 1 > done.lst
@jldupont
jldupont / gist:1738884
Created February 4, 2012 16:50
pyfnc example 1
from pyfnc import patterned, pattern
@pattern('male', str)
def greet_male(p1, p2):
return "Hello M. %s!" % p2
@pattern('female', str)
def greet_female(p1, p2):
return "Hello Mrs. %s!" % p2
@jldupont
jldupont / gist:1738545
Created February 4, 2012 15:41
Erlang / greet
greet(male, Name) ->
io:format("Hello, Mr. ~s!", [Name]);
greet(female, Name) ->
io:format("Hello, Mrs. ~s!", [Name]);
greet(_, Name) ->
io:format("Hello, ~s!", [Name]).
@jldupont
jldupont / gist:1731173
Created February 3, 2012 17:06
Fun with Python decorators
"""
Created on 2012-02-03
@author: jldupont
@pattern(int, str, [], "p1>p2")
@patterned
def function_name(p1, p2, p3):
@jldupont
jldupont / gist:1725592
Created February 2, 2012 20:31
jldleader example configuration file
-dp
/tmp/am_leader
-tn
election
-p
5
-dq
@jldupont
jldupont / gist:1691098
Created January 27, 2012 21:46
urllib2: fetch web page & return headers
import urllib2
response=urllib2.urlopen(page)
data=response.read()
headers=response.info().items()
@jldupont
jldupont / gist:1686323
Created January 27, 2012 01:22
Example configuration file for jldrxsqs
-e
-q
test
-p
5
@jldupont
jldupont / gist:1678996
Created January 25, 2012 21:46
nose class test
class Test():
@classmethod
def setup_class(self):
"""setup"""
@classmethod
def teardown_class(self):
"""teardown"""
@jldupont
jldupont / gist:1648943
Created January 20, 2012 18:43
Python: access a module's function
import sys
mod=sys.modules[__name__]
fnc=getattr(mod, fnc_name, None)
if fnc is not None:
fnc(args)