Skip to content

Instantly share code, notes, and snippets.

View bradjasper's full-sized avatar
💭
🚀 Building Focus, RemoteHabits and something new

Brad Jasper bradjasper

💭
🚀 Building Focus, RemoteHabits and something new
View GitHub Profile
@bradjasper
bradjasper / demo.py
Created October 30, 2009 20:06
Dead simple event tracking with celery and git
from mixpanel.tasks import TrackEvent
# Inside a view
def my_view(request):
TrackEvent.delay("search_view", {
"ip": request.META['REMOTE_ADDR'],
"distinct_id": session_id,
"time": time.time()})
@import blueprint/reset.sass
@import partials/base.sass
@import blueprint
@import blueprint/modules/scaffolding.sass
@import compass/utilities.sass
+blueprint-typography("body.bp")
+blueprint-scaffolding("body.bp")
# This isn't perfect for high traffic sites, if you need something more production ready
# please tell us or stay tuned as we will open it up shortly.
import subprocess
import base64
import simplejson
def track(event, properties=None):
"""
A simple function for asynchronously logging to the mixpanel.com API.
# Example of adapting Mixpanel task to work with Celery
import base64
import simplejson
import urllib2
def track(event, properties=None):
"""
A simple function for asynchronously logging to the mixpanel.com API.
@param event: The overall event/category you would like to log this data under
@bradjasper
bradjasper / show
Created April 20, 2011 18:38 — forked from tekacs/show
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
if __name__ == "__main__":
doIt();
SubtlePatterns Bookmarklet is a quick and easy way to see patterns from http://subtlepatterns.com on your site.
Drag this link <a href="javascript:(function()%7Bvar%20newscript%3Ddocument.createElement(%27script%27)%3Bnewscript.type%3D%27text/javascript%27%3Bnewscript.async%3Dtrue%3Bnewscript.src%3D%27https://raw.github.com/bradjasper/subtle-patterns-bookmarklet/master/bookmarklet.js%3Fcb%3D%27%20%2B%20Math.random()%3B(document.getElementsByTagName(%27head%27)%5B0%5D%7C%7Cdocument.getElementsByTagName(%27body%27)%5B0%5D).appendChild(newscript)%3B%7D)()%3B">Subtle Patterns Bookmarklet</a> to your bookmarks bar, and click it to activate on any site you want to change backgrounds on.
Press left and right to move between patterns. The current pattern is displayed in the lower left corner of the browser.
Similar projects:
http://raphaeleidus.com/2011/06/29/background-patterns-bookmarklet
@bradjasper
bradjasper / Test Google Fonts
Created November 6, 2013 21:56
This tests aborting font files from Google web fonts. This works as expected.
var page = require('webpage').create();
// Block fonts
var abort_content_types = [
"application/x-font-woff",
"font/woff",
"font/opentype",
];
// Default user agent won't work with TypeKit
@bradjasper
bradjasper / gist:7344832
Created November 6, 2013 21:58
This tests aborting font files from TypeKit web fonts. This doesn't work as expected.
var page = require('webpage').create();
// Block fonts
var abort_content_types = [
"application/x-font-woff",
"font/woff",
"font/opentype",
];
// Default user agent won't work with TypeKit
# ANSI color codes
RESET="\[\033[0m\]" # reset
HICOLOR="\[\033[1m\]" # hicolor
UNDERLINE="\[\033[4m\]" # underline
INVERSE="\[\033[7m\]" # inverse background and foreground
FBLACK="\[\033[30m\]" # foreground black
FRED="\[\033[31m\]" # foreground red
FGREEN="\[\033[32m\]" # foreground green
FYELLOW="\[\033[33m\]" # foreground yellow
FBLUE="\[\033[34m\]" # foreground blue