Skip to content

Instantly share code, notes, and snippets.

View pjhoberman's full-sized avatar

PJ Hoberman pjhoberman

  • Denver, Colorado
View GitHub Profile
<style type="text/css">
#join_box {
background-color: #000000;
border-radius: 8px 8px 8px 8px;
color: #FFFFFF;
margin-bottom: 10px;
padding: 30px;
}
@pjhoberman
pjhoberman / pre-commit
Created November 23, 2011 00:29
git hook - pre-commit
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
ERRORS=0
THRESHOLD=0
Forwarded conversation
Subject: [email protected]
------------------------
From: Ashley Mentele <[email protected]>
Date: Wed, Feb 1, 2012 at 3:23 PM
To: [email protected]
## Main File for Route Engine Splash
<%namespace file="/base/core_include.html" import="*"/>
<%namespace file="/routes/standalone/support.html" import="*"/>
<%
from django.conf import settings
import time
%>
## defined in support.html
${base_css()}
${base_js()}
class SponsoredRoute(models.Model):
'''
Route engine (route/create) advertiser sponsorships
Records cannot overlap in both site and date range.
'''
client = models.CharField(blank=False, null=False, max_length=128)
start = models.DateField(blank=False, null=False)
end = models.DateField(blank=False, null=False)
from . import models, utils
from django.contrib import admin
from forms import SponsoredRouteForm
cache_manager = utils.BestBefore(utils.LOOKUP_CACHE_PREFIX, utils.LOOKUP_CACHE_INVALIDATE)
class InvalidatingAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
super(InvalidatingAdmin, self).save_model(request, obj, form, change)
cache_manager.invalidate()
/*
round off a number to a desired precision,
and pad that number with zeroes if the result
has fewer decimal places than the desired precision
*/
function round_distance(value, precision) {
var rounded = Math.round( value * Math.pow( 10, precision ) ) / Math.pow( 10, precision );
if( precision > 0 ){
#! /bin/bash
content=`cat - | sed 's:":\\":g' | tr '\n' '\'`
curl --silent \
-i "https://api.github.com/gists" \
-H "" \
-X POST \
-H "Content-type: application/json" \
-d '{"public": true, "files": {"test.diff": {"content":"$content" }}}' | sed -n '/^{/,$ p' | JSON.sh | egrep '\["html_url"\]' | sed s:"\[\"html_url\"\]":: | sed 's:"::g' | pbcopy
diff --git a/mmf/goal/blocks/challenges.py b/mmf/goal/blocks/challenges.py
index bb074fe..c97a997 100644
--- a/mmf/goal/blocks/challenges.py
+++ b/mmf/goal/blocks/challenges.py
@@ -470,7 +470,7 @@ class UserTrophyBlock(blocks.Block):
'award_text': 'Awarded for completing all the <strong>{group} challenges</strong> on {date}'.format(
group=group.title,
date=escape(localize_date(last_challenge_completed))),
- 'last_completed': last_challenge_completed.date()})
+ 'last_completed': last_challenge_completed})
Environment:
Request Method: GET
Request URL: http://staging.panama.mapmyfitness.com/challenges/challenge/16/
Django Version: 1.2 beta 1 SVN-13007
Python Version: 2.6.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.comments',