Skip to content

Instantly share code, notes, and snippets.

View harobed's full-sized avatar
💭
CTO at Spacefill

Stéphane Klein harobed

💭
CTO at Spacefill
View GitHub Profile
@harobed
harobed / gist:3905199
Created October 17, 2012 12:07
How to use jQuery simulate with CasperJS
casper.then(function() {
this.test.assertEval(function() {
$('[name="name"]').simulate("key-sequence", {sequence: "{selectall}Foobar"});
return $('.title').text() == 'Foobar';
});
});
@harobed
harobed / gist:3713283
Created September 13, 2012 09:49
Mon programme au PyCon FR 2012
Samedi matin :
* Processus de développement de CPython (Antoine Pitrou)
* La boite à outils pour Django (Ordoquy Xavier)
* Picasso, le polyglotte et le philosophe (Marc Chantreux)
* Je configure mes serveurs avec fabric et fabtools (Ronan Amicel)
Samedi après midi :
* OpenERP : gestion d'entreprise Open Source en Python (Alexandre ALLOUCHE)
@harobed
harobed / How to fill dict attribute with Factory-boy ?
Created June 27, 2012 08:49
How to fill dict attribute with Factory-boy ?
class UserFactory(factory.Factory):
FACTORY_FOR = User
first_name = factory.InfiniteIterator([ 'Peggie', 'Gabe', 'King', 'Fredy', 'Ole', 'Vernice' ])
last_name = factory.InfiniteIterator([ 'Leannon', 'Barton', 'Sauer', 'Walker', 'Strosin'])
username = factory.LazyAttribute(
lambda o: '%s.%s@example.com' % (o.first_name.lower(), o.last_name.lower())
)
# How can I feed data in dict, metadata isn't another Entities (MongoDB context)
#!/bin/bash
#
# lxc: linux Container library
# Authors:
# Daniel Lezcano <daniel.lezcano@free.fr>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
from contextlib import nested
from fabric.api import task, run, settings, env
def switch_user(user):
return nested(settings(
user=user,
host_string="%s@%s:%s" % (user, env['host'], env['port'])
))
@task