Skip to content

Instantly share code, notes, and snippets.

View evaisse's full-sized avatar

Emmanuel Vaïsse evaisse

  • none
  • Nancy, France
View GitHub Profile
from models import Ent
def randomstr():
import random
alphabet = u'abcdefghijklmnopq rstuvwxyzéièùïà\'"'
alphabet + alphabet.upper()
string=''
for count in xrange(1,50):
for x in random.sample(alphabet,random.randint(1,15)):
string+=x
(function($){
$.fn.textspinner = function(options) {
var defaults = {
fadeInTime: 200,
fadeOutTime: 200,
showDelay: 200
@evaisse
evaisse / firephp.php
Created April 1, 2010 10:42
log into firebug/firephp extensions
<?php
/**
* log into firebug/firephp extensions
*
* @see http://www.firephp.org
* @example
firephp($var);
firephp($var, LOG_ERR);
<?php #-*- coding: utf-8 -*-
/**
* Unaccent the input string string. An example string like `ÀØėÿᾜὨζὅБю`
* will be translated to `AOeyIOzoBY`
*
* @param string $str
*
* @return string unaccented string
*/
#!/usr/bin/python
"""Usage: python flickrset2backup.py api_key photoset_id /path/to/backup/folder
find your set id in the set url
http://www.flickr.com/photos/evaisse/sets/72157602716593936/
get userid with idgetr http://idgettr.com/
ex : ./flickrset2backup.py 4c2f9a5259c09c04c2fcd2a7 \
72157602716593936 ./backup
"""
__author__ = "Emmanuel Vaisse <[email protected]>"
<?php #-*- coding: utf-8 -*-
/**
* Format and translit a string like "The Fantastic ~'étonnante' permalink url" => "the-fantastic-etonnante-permalink-url"
*
* @param string $string string to
* @param bool $dot_allowed allow dots (only one) chars in url
* @return string
*/
function urlize($string, $dot_allowed=false) {
RewriteCond %{QUERY_STRING} reload [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^plugins/thumbs/img/([a-z]+)-([1-9][0-9]*)x([1-9][0-9]*)-(.*)$ /plugins/thumbs/thumb.php/$1/$2/$3/?file=$4 [L]
@evaisse
evaisse / contact.php
Created January 29, 2010 12:02
validate email
<?php
$DESTINATAIRE = '[email protected]';
$SUJET = 'Message reçu depuis '.$_SERVER['HTTP_HOST'].' ';
function valid_email($email) {
$atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';
$domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)';
$regex = '/^' . $atom . '+' .
<?php
// Start XML file, create parent node
$xml = new XMLWriter();
$xml->openMemory(); // create document in memory (AKA storing into a var)
$xml->setIndent(true); // autoindent output
$xml->setIndentString(' '); // set kind of indentation
$xml->startDocument('1.0','UTF-8'); // start xml declaration with encoding utf-8
@evaisse
evaisse / password.php
Created December 11, 2009 11:07
Password generation
<?php
$pass = (chr((int)rand(97,122))).(chr((int)rand(67,90))).(rand(1000,9999));