Skip to content

Instantly share code, notes, and snippets.

View thisfred's full-sized avatar

eric casteleijn thisfred

View GitHub Profile
CmdUtils.CreateCommand({
name: "lastfm",
icon: "http://cdn.last.fm/flatness/favicon.2.ico",
// homepage: "http://thisfred.blogspot.com/",
author: { name: "eric casteleijn", email: "thisfred@gmail.com"},
license: "GPL",
description: "Looks up artists or tracks on last.fm",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
var msg = 'Looks up "${inputText}" on lastfm.';
@thisfred
thisfred / lai.py
Created July 10, 2012 20:02 — forked from lvidarte/lai.py
# -*- coding: utf-8 -*-
import argparse
import json
import re
import u1db
from datetime import datetime
function! SuperCleverTab()
if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
return "\<Tab>"
else
if &omnifunc != ''
return "\<C-X>\<C-O>"
elseif &dictionary != ''
return "\<C-K>"
else
return "\<C-N>"
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'>
>>>
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>

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.)
"""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('-')]
>>> 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
def foo():
closed = {'a': 1}
def increase():
closed['a'] += 1
print(closed['a'])
return increase
my_counter = foo()