Skip to content

Instantly share code, notes, and snippets.

View jperras's full-sized avatar
💨
what what is this where am I

Joël Perras jperras

💨
what what is this where am I
View GitHub Profile
@jperras
jperras / .vimrc
Last active September 10, 2020 15:12
Useful vim plugins
scrooloose/nerdcommenter
jreybert/vimagit
tpope/vim-fugitive
airblade/vim-gitgutter
tpope/vim-abolish
tpope/vim-unimpaired
sbdchd/neoformat
junegunn/fzf
junegunn/fzf.vim
sheerun/vim-polyglot

Keybase proof

I hereby claim:

  • I am jperras on github.
  • I am jperras (https://keybase.io/jperras) on keybase.
  • I have a public key ASCVivxJMcbrFE90EG9HP9m-8n2c6R4QT9RupAR8allhRgo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jperras on github.
  • I am jperras (https://keybase.io/jperras) on keybase.
  • I have a public key ASA-OCKAnBMfI7bTurWTNXXubHO0YbTY91T5W_OH6mir6wo

To claim this, I am signing this object:

@jperras
jperras / test.rb
Created September 24, 2015 17:50
Ruby… where you have to know internal parser logic for symbol table construction & lookup to determine what 7 lines of code produces.
def foo(bar)
print bar
end
foo = 42
foo foo
# Any guesses as to what this will do? :)

Keybase proof

I hereby claim:

  • I am jperras on github.
  • I am jperras (https://keybase.io/jperras) on keybase.
  • I have a public key whose fingerprint is E037 2F0C 60D9 E241 4798 D5FE 152E F87B 8F10 DBBF

To claim this, I am signing this object:

@jperras
jperras / setup.py
Created March 11, 2015 15:26
A very nice setup.py example from graphite-pager.
#!/usr/bin/env python
from graphitepager import __version__
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
@jperras
jperras / keybase.md
Created November 4, 2014 21:10
keybase.md

Keybase proof

I hereby claim:

  • I am jperras on github.
  • I am jperras (https://keybase.io/jperras) on keybase.
  • I have a public key whose fingerprint is 2121 D612 0B35 7295 F50B 743F 528A 7A79 5177 65B1

To claim this, I am signing this object:

@jperras
jperras / approximate_subset_sum.py
Last active December 16, 2017 13:17
Approximate Subset Sum
# -*- coding: utf-8 -*-
import itertools
import operator
def trim(data, delta):
"""Trims elements within `delta` of other elements in the list."""
output = []
@jperras
jperras / slugify.py
Created July 10, 2013 15:34
Generate an ASCII-only slug based off of a unicode string.
from unidecode import unidecode
# Regular expression to match most "punctuation"
punctuation_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
def slugify(text, delimiter=u'-'):
"""Generates an ASCII-only slug."""
result = []
for word in punctuation_re.split(text.lower()):
import re
version_pattern = re.compile(r"/v(?P<version>[0-9a-z\-\+\.]+)", re.IGNORECASE)
class VersionedAPIMiddleware(object):
"""
Allows a Werkzeug/Flask application to have a versioned API.
This middleware will extract out the API version specification in a URL