Skip to content

Instantly share code, notes, and snippets.

View cvan's full-sized avatar
🚌
🌊

Christopher Van cvan

🚌
🌊
View GitHub Profile
@cvan
cvan / .bashrc
Created June 11, 2011 22:16
zamboni aliases
export ZAMBONI_PATH=~/Sites/projects/zamboni
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " (%s)")\$ '
source /usr/local/etc/bash_completion.d/git-completion.bash
export WORKON_HOME=$HOME/.virtualenvs
source $HOME/.virtualenvwrapper
z() {
cd $ZAMBONI_PATH
@cvan
cvan / gist:1488826
Created December 17, 2011 01:41
auto upload mac screenshots to imgur
function ss {
IMGUR_API_KEY="GET_YOUR_OWN"
SCREENSHOT="/tmp/`date +%s`.png"
screencapture -iW ${SCREENSHOT}
echo "Sending ${SCREENSHOT} ..."
curl -F "image=@${SCREENSHOT}" -F "key=${IMGUR_API_KEY}" http://api.imgur.com/2/upload.xml | sed "s/.*<original>\([^<]*\).*<.*/\1/" | pbcopy
}
@cvan
cvan / gist:1491093
Created December 17, 2011 19:14
zamboni aliases
~/.aliasrc
# Django
alias z='cd ~/Sites/projects/zamboni2 && workon z'
alias zpull='z && git checkout master && git pull && git submodule sync && git submodule update --init --recursive'
alias zup='zpull && ./vendor/src/schematic/schematic migrations'
alias check5="git whatchanged $1 -1 | awk '/^:/ {print $NF}' | xargs /vendor/src/check/check.py"
# Testing
alias testme='manage.py test --noinput -s --logging-clear-handlers'
@cvan
cvan / speed.py
Last active September 28, 2015 20:58
benchmark script for nose tests
#!/usr/bin/env python
import subprocess
import sys
trials = 5
force_drop = True
branch = 'factories'
test_db = 'test_zamboni'
@cvan
cvan / git-open.sh
Created December 19, 2011 20:20
open git commit in browser for reviews
#!/bin/sh
# Usage: `git url` or `git url <commitish>`
#
# * copies the commit's github url to your clipboard
# * prints out the log message
# * opens the bugzilla page if it found a bug number
#
# Set up the github url with `git config github.url <url>`.
# Only for the Mac.
@cvan
cvan / git-examine.sh
Created December 29, 2011 19:59
open file on github in browser
#!/bin/sh
# Usage: `git examine <url>`
#
# * opens the github page if it found the file
#
# Only for the Mac.
if [[ $1 ]]; then
FILE=$1
else
@cvan
cvan / failures
Created March 1, 2012 23:00
wonky ES
(z)(system.local) %% testme search.tests.test_views:TestESWonkiness ~/Sites/projects/zamboni2 (es-coll)
/Users/chris/Sites/projects/zamboni2/vendor/src/django/django/conf/__init__.py:72: DeprecationWarning: If set, STATIC_URL must end with a slash
DeprecationWarning)
nosetests --verbosity 2 search.tests.test_views:TestESWonkiness --with-fixture-bundling --exclude=mkt/* -s --logging-clear-handlers -a!sphinx
Reusing old database "test_zamboni_mkt". Set env var FORCE_DB=1 if you need fresh DBs.
No handlers could be found for logger "rdflib"
/Users/chris/Sites/projects/zamboni2/vendor/lib/python/paypalx/getPermissionsAuthHeader.py:4: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import random,md5,time
test (search.tests.test_views.TestESWonkiness) ... /Users/chris/Sites/projects/zamboni2/apps/addons/models.py:301: DeprecationWarning: object.__new__() takes no parameters
return super(Addon, cls).__new__(cls, *args, **kw)
diff --git a/media/js/mkt/apps.js b/media/js/mkt/apps.js
index a43b8d8..a8394b7 100644
--- a/media/js/mkt/apps.js
+++ b/media/js/mkt/apps.js
@@ -42,7 +42,7 @@ exports.install = function(product, opt) {
$def = $.Deferred();
/* Try and install the app. */
if (manifestUrl && opt.navigator.mozApps && opt.navigator.mozApps.install) {
- var installRequest = opt.navigator.mozApps.install(manifestUrl, opt);
+ var installRequest = opt.navigator.mozApps.install(manifestUrl, opt.data);
@cvan
cvan / __init__.py
Created April 30, 2012 07:04
better app_factory
diff --git a/apps/amo/tests/__init__.py b/apps/amo/tests/__init__.py
index 893e59f..0e6c299 100644
--- a/apps/amo/tests/__init__.py
+++ b/apps/amo/tests/__init__.py
@@ -326,8 +326,20 @@ def assert_no_validation_errors(validation):
def app_factory(**kw):
- kw.update(type=amo.ADDON_WEBAPP)
- return amo.tests.addon_factory(**kw)
@cvan
cvan / .aliasrc
Created May 15, 2012 22:31
best workflow
# Django
z='cd ~/Sites/projects/zamboni2 && workon z'
zpull="z && git checkout master && git pull && git submodule update && git submodule --quiet foreach 'git submodule --quiet sync && git submodule update --init --recursive'"
zup='zpull && ./vendor/src/schematic/schematic migrations'