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 functools import partial | |
def some_view(request): | |
line_chart = LineChart() | |
render(request, 'template.html', { | |
'line_chart_as_html_200': partial(line_chart.as_html, line_chart, '200'), | |
}) |
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
$('button').on('click', function(e) { | |
var self = this; | |
e.preventDefault(); | |
user.get({ | |
limit: 1, | |
'mark_read': [$(this).attr('group')], | |
}).then(function(results) { | |
window.location = $(self).attr('href'); | |
}); |
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 stream = require('getstream'); | |
var client = stream.connect('API_KEY', 'API_SECRET'); | |
var feed = client.feed('notification', 'bandsintown-' + Date.now()); | |
function errorHandler(error) { | |
console.error('Error: ', error['error']); | |
} |
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
// Instruct the integration library to add hook handlers | |
// on creation and removal to add or remove items on the | |
// getstream.io API: | |
Stream.registerActivity(Activities, { | |
activityVerb: 'cook', | |
activityActorProp: 'userId', | |
}); |
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
parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
parse_git_tag () { | |
git describe --tags 2> /dev/null | |
} | |
parse_git_branch_or_tag() { | |
local OUT="$(parse_git_branch)" |
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
SELECT myColumn, count( myColumn ) AS myCount | |
FROM myTable | |
GROUP BY myColumn | |
HAVING myCount >1 | |
ORDER BY myCount |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
*.pyc |
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
ROOT_UID=0; # Only users with $UID 0 have root privileges | |
E_NOTROOT=87; # Non-root exit error | |
# Run as root | |
if [ "$UID" -ne "$ROOT_UID" ]; then | |
echo "Must be root to run this script." | |
exit $E_NOTROOT; | |
fi |
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 | |
# Read arguments | |
# Author: Matthisk Heimensen | |
NO_ARGS=0 | |
E_OPTERROR=85 | |
if [ $# -eq "$NO_ARGS" ]; then # Script invoked with no command-line args | |
echo "Usage: `basename $0` options (-upfh)" | |
exit $E_OPTERROR # Exit and explain usage |
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
HomeController = RouteController.extend({ | |
onBeforeAction: function () { | |
this.feedSubscription = feedSubscription; | |
} | |
}); |
NewerOlder