Skip to content

Instantly share code, notes, and snippets.

Peter Georgeson supernifty

Block or report user

Report or block supernifty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@supernifty
supernifty / gist:1219096
Created Sep 15, 2011
Python localization
View gist:1219096
import gettext
import locale
import logging
def init_localization():
'''prepare l10n'''
locale.setlocale(locale.LC_ALL, '') # use user's preferred locale
# take first two characters of country code
loc = locale.getlocale()
filename = "res/messages_%s.mo" % locale.getlocale()[0][0:2]
@supernifty
supernifty / gist:1087170
Created Jul 17, 2011
JavaScript task queue
View gist:1087170
var queue = function() {
var tasks;
return {
start: function( list ) {
tasks = list;
first = tasks.pop();
first();
},
@supernifty
supernifty / profile.php
Created Nov 9, 2010
Ultra Simple PHP Profiler
View profile.php
<?php
$_start = 0;
$_subdata = '';
function profile_start() {
global $profile;
if ( $profile ) {
global $_start, $_subdata;
$_start = microtime(true);
$_subdata = '';
You can’t perform that action at this time.