Skip to content

Instantly share code, notes, and snippets.

View thisfred's full-sized avatar

eric casteleijn thisfred

View GitHub Profile
def foo():
return bar()
def bar():
return True
if __name__ == '__main__':
print foo()
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'alfredodeza/pytest.vim'
UNDEFINED = object()
def foo(arg=UNDEFINED):
if arg is UNDEFINED:
arg = [your, list]
def foo():
a = 1
while True:
a += 1
yield a
counter = foo()
print counter.next()
print counter.next()
def foo():
closed = {'a': 1}
def increase():
closed['a'] += 1
print(closed['a'])
return increase
my_counter = foo()
>>> import numpy as np
>>> import statsmodels.api as sm
>>> Y = [1,3,4,5,2,3,4]
>>> X = range(1,8)
>>> X = sm.add_constant(X)
>>> model = sm.OLS(Y,X)
>>> results = model.fit()
>>> results.params
array([ 2.14285714, 0.25 ])
>>> results.tvalues
"""Old as Balls."""
import sys
from datetime import datetime, timedelta
def main(birthday):
"""Generate a link to make you feel old."""
year, month, day = [int(part.strip()) for part in birthday.split('-')]

Portland

Beer:

  • Apex (huge selection on tap, laid back atmosphere)
  • Cascade (only if you like sour beers, but if so, you're in heaven)
  • Hair of the Dog (Belgian style ales, sweet and strong, often barrel aged.)
  • Bailey's Tap Room (large selection, centrally located, usually crowded with techies, though. They have an upstairs which is sometimes quiter, but not always open.)
  • Breakside (One of my favorite breweries in town, not very central though.)
  • Prost (Lots of German imported beers.)
set completeopt=longest
function! SuperCleverTab()
if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
return "\<tab>"
else
return "\<C-P>"
endif
endfunction
inoremap <Tab> <C-R>=SuperCleverTab()<cr>
>>> def foo(*args):
... print type(args)
...
...
>>> foo([1, 2, 3])
<type 'tuple'>
>>>