Skip to content

Instantly share code, notes, and snippets.

View joeyespo's full-sized avatar

Joe Esposito joeyespo

View GitHub Profile
@joeyespo
joeyespo / jQuery to change font.js
Created April 15, 2011 16:39
Changes the font of all p HTML elements to Verdana
javascript:jQuery("p").css("font", "75%/150% 'Verdana'").css("letter-spacing", "0px")
@joeyespo
joeyespo / try_init_FBO
Created May 21, 2011 05:20
A Python port of the initialization code from a gamedev.net post
# Ported from: http://www.gamedev.net/topic/318673-fbo-question/
#
# Revised to remove the references to cocos2d
import pyglet
from pyglet.gl import *
from ctypes import c_ulong
def init():
# Ported from: http://www.gamedev.net/topic/318673-fbo-question/
@joeyespo
joeyespo / gist:3744643
Created September 18, 2012 17:53
See what's appending to <body> causing the IE8 error
<!-- Add this within the <body>, just before the first <script> or <%:Html.Script%> element -->
<script>
console.log('Capturing appendChild()');
var base = document.body;
var appendChild = base.appendChild;
base.appendChild = function(element) {
console.log(element);
console.trace();
return appendChild.apply(this, arguments);
};
@joeyespo
joeyespo / index.html
Created November 8, 2012 20:33
Adds a 'trimmed' function to observables for applying trim.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Example of Knockout Trimmed Observables</title>
<style>
h1 { font-size: x-large; }
h2 { font-size: large; }
p { margin: 32px; }
pre { padding: 32px; }
@joeyespo
joeyespo / static_for.py
Created November 10, 2012 19:50
Provides the static_for jinja helper function.
# For use within a Flask application using 'app'
def static_for(filename, endpoint='.static'):
"""Gets the specified static file."""
return url_for(endpoint, filename=filename)
app.jinja_env.globals.update(static_for=static_for)
@joeyespo
joeyespo / example.js
Created February 12, 2013 17:25
Please, support "open link in new tab" when handling <a> clicks!
$(element).click(function(e) {
// Allow the link to act normally when middle-clicking
// or clicking with a modifier key
if (e.which !== 1 || e.shiftKey || e.ctrlKey || e.altKey) {
return true;
}
// --YOUR CODE--
}
@joeyespo
joeyespo / app.py
Last active May 5, 2017 04:56
Example XSS with the new `|tojson` behavior in Flask 0.10
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
# Expected value
ids = [u"one", u"two's", u'"three"']
@joeyespo
joeyespo / Procfile
Last active August 29, 2015 14:11
Foreman and Honcho port precedence tests
web: python -u app.py
@joeyespo
joeyespo / Procfile
Last active August 29, 2015 14:11
Foreman and Forego port precedence tests
web: python -u app.py
@joeyespo
joeyespo / README.md
Last active August 29, 2015 14:13 — forked from dgehrett/README.md
Source code for a Mandrill Dashing widget for use with the Shopify Dashing framework