Skip to content

Instantly share code, notes, and snippets.

@pvalencia
pvalencia / .bashrc
Created May 20, 2010 02:50 — forked from henrik/.bashrc
function get_short_commit {
git log -n 1 --format=oneline --abbrev-commit 2> /dev/null | sed -e 's/\([0-9a-f]*\)\(.*\)/\1/'
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1 $(get_short_commit)]$(parse_git_dirty)/"
}
import re
HTML_REMOVER = lambda html: re.compile(r'<.*?>').sub('', html)
assert HTML_REMOVER('<html><body>foo <strong>bar</strong></body></html>') == 'foo bar'
<html>
<head>
<style>
div {
width: 300px;
height: 200px;
float: left;
background-color: green;
border: 1px solid black;
margin: 2px;