Skip to content

Instantly share code, notes, and snippets.

View nvie's full-sized avatar
🍀
Simplifying things

Vincent Driessen nvie

🍀
Simplifying things
View GitHub Profile
@nvie
nvie / pip-compile-specifics.txt
Created October 2, 2012 18:44
Cram test describing the interface for the pip-compile command.
Moved to https://github.com/nvie/pip-tools/blob/future/tests/pip-compile-specifics.t
@nvie
nvie / gist:3607425
Created September 3, 2012 06:51 — forked from bulkan/gist:3606776
rq job attributes
job = Job.fetch(job_id)
job.my_attr = ['one', 'two']
job.save()
# re-fetch job
job = Job.fetch(job_id)
print type(job.my_attr)
<type 'str'>
print job.my_attr
"['one', 'two']" # should be unpickled to a list, not a str
@nvie
nvie / mountain-lion-brew-setup.markdown
Created July 26, 2012 07:46 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

StillMaintained status buttons

Nice status buttons you can add to your README file in your Github repositories to show your project’s current status, fetched from StillMaintained:

   

For a live demo, check out StillMaintained’s own README.

Code

@nvie
nvie / gist:727282
Created December 3, 2010 17:56 — forked from hmarr/gist:727195
from mongoengine import *
from mongoengine import DENY, CASCADE, NULLIFY, DO_NOTHING
from mongoengine import DeleteForbidden # or something equivalent
from mongoengine.queryset import QuerySet
class Post(Document):
title = StringField()
@classmethod
>>>True,False=False,True
>>>False
True
>>>1==2
False
>>>(1==2)==True
True
>>> # This shows how setting True/False is nothing more than a simple (yet scary!)
>>> # variable assignment in the local scope:
require 'formula'
class GitFlow <Formula
url 'git://github.com/nvie/gitflow.git'
version '0.2'
homepage 'http://github.com/nvie/gitflow'
md5 'da3d5ff107f8fec1dad9aa3c0bc357a3'
depends_on 'git'
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@nvie
nvie / .bashrc
Created December 17, 2009 09:15 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
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$(parse_git_dirty)]/"