Skip to content

Instantly share code, notes, and snippets.

diff --git a/lettuce/languages.py b/lettuce/languages.py
index 02401d7..4e52709 100644
--- a/lettuce/languages.py
+++ b/lettuce/languages.py
@@ -23,7 +23,7 @@ LANGUAGES = {
'native': u'English',
'scenario': u'Scenario',
'scenario_outline': u'Scenario Outline',
def _cmp(a, b):
# print a, b
if a == b:
return 0
if a.startswith(b) == 0:
return 1
else:
return -1
# my CMP... Comparing the first letter is not enough, IMHO.
@brunobord
brunobord / gist:1333685
Created November 2, 2011 13:56
Chained string transformations
### My question is: is this solution elegant enough?
### I mean: if I'm adding several other functions to "clean" my "cell", will it still be "Pythonic"?
### e.g.: for f in (func1, func2, func3, func..): stuff = f(stuff)
def strip(cell):
return cell.strip()
def removedblspaces(cell):
return u' '.join(cell.split())
@brunobord
brunobord / le Cod
Created November 10, 2011 13:52
blagounette à deux zeuros
Oh troll, oh désespoir, oh java ennemi
N'ai-je donc tant codé que pour cette infâmie ?
Et me suis-je commit dans des hacks réguliers
Que pour voir en un bug flétrir tant de guillemets ?
@brunobord
brunobord / *.sublime-keymap
Created May 24, 2012 08:40 — forked from n1k0/*.sublime-keymap
SublimeText2 macro and key binding for quickly wrapping text at 80 columns
/**
* Sample key binding (emacs users will hate it, but they're probably not using SublimeText2)
*
*/
[
{ "keys": ["ctrl+w"], "command": "run_macro_file", "args": {"file": "Packages/User/Quick Wrap.sublime-macro"}}
]
@brunobord
brunobord / .sublime-keymap
Created May 24, 2012 08:52
SublimeText2 macro and key binding for quickly wrapping text at 80 columns
/**
* wrap_line command will use the "rulers" settings to calculate le line width.
*/
[
{ "keys": ["alt+q"], "command": "wrap_line"}
]
@brunobord
brunobord / ola.py
Created June 22, 2012 09:26
Olà in Python / ASCII art
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import time
def cls():
os.system(['clear', 'cls'][os.name == 'nt'])
figure_repos = '.o.'
@brunobord
brunobord / gist:3796330
Created September 27, 2012 20:37
ERB not working
require 'erb'
weekday = Time.now.strftime('%A')
simple_template = "Today is <%= weekday %>."
renderer = ERB.new(simple_template)
puts output = renderer.result()
# This throws:
# NameError: undefined local variable or method `weekday' for #<Object:0x10116b2a8>
@brunobord
brunobord / bash_prompt.sh
Created October 14, 2012 14:07 — forked from bradsokol/bash_prompt.sh
Set color bash prompt according to active virtualenv, Git, Mercurial or Subversion branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current Git, Mercurial or Subversion repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@brunobord
brunobord / djangobotfr.py
Created December 14, 2012 21:44
Django bot, used on #django-fr on Freenode. Very basic at the moment. Please be kind. Is using cmdbot: https://github.com/brunobord/cmdbot
#-*- coding: utf8 -*-
import logging
from cmdbot.core import Bot, direct
from cmdbot.core import logger
from cmdbot.configs import ArgumentConfiguration
logger.setLevel(logging.DEBUG)
class Djangobot(Bot):
welcome_message = "Salut les djangosaures !"