Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
typing

Joël Perras jperras

💭
typing
View GitHub Profile
@jperras
jperras / .vimrc
Last active Sep 10, 2020
Useful vim plugins
View .vimrc
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
View 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 ASCVivxJMcbrFE90EG9HP9m-8n2c6R4QT9RupAR8allhRgo

To claim this, I am signing this object:

View 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 ASA-OCKAnBMfI7bTurWTNXXubHO0YbTY91T5W_OH6mir6wo

To claim this, I am signing this object:

@jperras
jperras / test.rb
Created Sep 24, 2015
Ruby… where you have to know internal parser logic for symbol table construction & lookup to determine what 7 lines of code produces.
View test.rb
def foo(bar)
print bar
end
foo = 42
foo foo
# Any guesses as to what this will do? :)
View 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 E037 2F0C 60D9 E241 4798 D5FE 152E F87B 8F10 DBBF

To claim this, I am signing this object:

@jperras
jperras / setup.py
Created Mar 11, 2015
A very nice setup.py example from graphite-pager.
View setup.py
#!/usr/bin/env python
from graphitepager import __version__
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
View 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 Dec 16, 2017
Approximate Subset Sum
View approximate_subset_sum.py
# -*- 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 Jul 10, 2013
Generate an ASCII-only slug based off of a unicode string.
View slugify.py
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()):
View versioned_middleware.py
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