zj
moves the cursor to the next fold.zk
moves the cursor to the previous fold.zo
opens a fold at the cursor.zO
opens all folds at the cursor.zm
increases the foldlevel by one.zM
closes all open folds.zr
decreases the foldlevel by one.zR
decreases the foldlevel to zero -- all folds will be open.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show log of modified files: | |
git log --name-only | |
Previous revision of a file: | |
git show REVISION:path/to/file | |
Merge upstream git branch: | |
git fetch upstream | |
git merge upstream/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import csv | |
import logging | |
import re | |
import sys | |
import time | |
import unittest | |
from bs4 import BeautifulSoup | |
from selenium import webdriver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def groupreduce(iterable, groups, is_part_of_group, add_item_to_group): | |
""" | |
Reduces a sorted iterable into groups. | |
>>> iterable = iter((1, 2, 8, 12, 32, 35)) | |
>>> groups = (10, 20, 30, 40, 50) | |
>>> | |
>>> def is_part_of_group(group_id, item): | |
>>> return group_id-10 <= item < group_id | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.functional import curry | |
def spicy_curry(kallable, *args, **kwargs): | |
class CurryMixin(object): | |
def __init__(self, *moreargs, **morekwargs): | |
return super(CurryMixin, self).__init__( | |
*(args+moreargs), **dict(kwargs, **morekwargs)) | |
res = type(kallable.__name__, (CurryMixin, kallable), {}) | |
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def strjoin(*args, **kwargs): | |
""" Concatenates the arguments, ignoring any arguments that are empty or | |
None. | |
""" | |
delim = kwargs.get('delim', '\n') | |
res = '' | |
first = True | |
for arg in args: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import traceback | |
from django.conf import settings | |
from django.core import mail | |
from django.utils.log import AdminEmailHandler | |
from django.views.debug import ExceptionReporter | |
from django.views.debug import get_exception_reporter_filter | |
from .str_tools import strjoin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Takes a list of plain-text gigs (or events) in descending date order, and formats | |
them for the web in ascending date order. Here's an example of the input that's | |
expected (make sure to hit CTRL+D at the end of the input: | |
3/7: City Tap (Pay Notes) - 80% | |
City Tap (Philadelphia): City Tap House Philadelphia, PA | |
Shimmy | |
Drums: Alex (Pay Notes) | |
?Bass: Matt (Pay Notes) |