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
var process = function(queue) { | |
var data = { stop: false }; // Shared data | |
(function next() { | |
if (data.stop) { | |
$.isFunction(options.stopCallback) | |
? options.stopCallback(data) | |
: options.callback(data); | |
return; | |
} | |
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
var i = 0, queue = []; | |
// Put some functions at the queue | |
queue.push(function(data, next) { console.log(++i, data); setTimeout(next, 1000); }); | |
queue.push(function(data, next) { console.log(++i, data); setTimeout(next, 1000); }); | |
queue.push(function(data, next) { console.log(++i, data); setTimeout(next, 1000); }); | |
queue.push(function(data, next) { console.log(++i, data); setTimeout(next, 1000); }); | |
process(queue, { | |
stopCallback: function(data) { console.log('stop callback', data); }, // optional |
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
# Via ./manage.py shell | |
from django.contrib.auth.models import User | |
admin = User.objects.get(username='admin') | |
admin.set_password('new password'); | |
users[0].save() |
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/bash | |
VENV=$1 | |
if [ -z $VENV ]; then | |
echo "usage: runinenv [virtualenv] CMDS" | |
exit 1 | |
fi | |
. ${WORKON_HOME}/${VENV}/bin/activate | |
shift 1 | |
echo "Executing $@ in ${VENV}" | |
exec "$@" |
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
MAKE := make --no-print-directory | |
DESCRIBE := $(shell git describe --match "v*" --always --tags) | |
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE)) | |
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS)) | |
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS)) | |
VERSION := $(subst v,,$(VERSION_TAG)) | |
VERSION_PARTS := $(subst ., ,$(VERSION)) |