View dual_decorator.py
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 dual_decorator(func): | |
"""This is a decorator that converts a paramaterized decorator for no-param use.""" | |
# modified from http://stackoverflow.com/a/10288927/1231454. | |
@functools.wraps(func) | |
def inner(*args, **kw): | |
if ((len(args) == 1 and not kw and callable(args[0]) | |
# Exceptions are callable; the next line allows us to accept them as args. | |
and not (type(args[0]) == type and issubclass(args[0], BaseException)))): | |
return func()(args[0]) |
View script.js
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
function is_non_inbox_node(node){ | |
var is_non_inbox = false; | |
if (node.isContentEditable || | |
node.tagName == 'INPUT' || | |
node.tagName == 'TEXTAREA' || | |
node.getAttribute('aria-haspopup') == 'true' | |
){ | |
is_non_inbox = true; | |
} |
View lint.sh
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
#!/usr/bin/env bash | |
# Usage: | |
# | |
# lint [file1] [file2]... | |
# | |
# With no arguments, lint any tracked files with modifications. | |
# Get venmolint.py into the path so that git-lint detects it. |
View pre-commit.sh
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
#!/bin/sh | |
GITROOT=`git rev-parse --show-toplevel` | |
EXIT_STATUS=0 | |
# Lint all the files in the index, excluding deletions and directories. | |
git diff-index -z --cached --name-only --diff-filter='ACMRTUXB' HEAD | xargs -0 ls -dp | grep -v '/$' | xargs "$GITROOT/lint" | |
if [ "$?" != "0" ]; then |
View gist:1361260
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
irb(main):010:0> t = Tag.new(:rfid => 999, :item_id => 1) | |
=> #<Tag id: nil, rfid: 999, created_at: nil, updated_at: nil, item_id: 1> | |
irb(main):011:0> t.item | |
=> #<Item id: 1, description: "burger", price: #<BigDecimal:b6f6f46c,'0.5E1',4(8)>, created_at: "2011-11-12 03:16:19", updated_at: "2011-11-12 03:16:19"> | |
irb(main):012:0> t.item_id = 2 | |
=> 2 | |
irb(main):013:0> t.save |
View makefile
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
KERNEL_MAKE_ARGS = | |
KERNEL_DIR = ../linux-2.6.26.5 | |
# this isn't actually a list | |
DO_NOT_COPY = makefile | |
all: rm_moved_files src_copy | |
.FORCE: |
View gist:4960475
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 mutagen | |
log = logging.getLogger(__name__) | |
def copy_md_tags(from_fname, to_fname): | |
"""Copy all metadata from *from_fname* to *to_fname* and write. |
View muspy2gcal.py
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 os.path | |
import requests | |
#Google client api imports | |
import gflags | |
import httplib2 | |
from apiclient.discovery import build | |
from oauth2client.file import Storage | |
from oauth2client.client import OAuth2WebServerFlow |
View proboscis_after_class_bug.py
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 proboscis import test, after_class, TestProgram | |
@test | |
class Test(object): | |
@after_class | |
def will_skip_but_should_not(self): | |
pass | |
@test |
View checkout-dates.sh
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
find /localdisk/winter-snapshot/code/ -mindepth 2 -maxdepth 2 | xargs -P 32 -n 1 -I {} bash -c 'cd $1; git checkout -q $(git rev-list -n 1 --before="2012-11-30" $(git rev-parse --abbrev-ref HEAD)) -- || pwd' -s {} 2>&1 | tee outputfile |
OlderNewer