Skip to content

Instantly share code, notes, and snippets.

View joeyespo's full-sized avatar

Joe Esposito joeyespo

View GitHub Profile
@joeyespo
joeyespo / npm-exec.bat
Last active June 11, 2022 17:15
Execute a node_modules/.bin script on Windows.
@ECHO OFF
SETLOCAL
REM Speed up by checking for bin directory directly
IF NOT EXIST node_modules\.bin GOTO FINDBIN
SET BIN=.\node_modules\.bin
GOTO RUN
:FINDBIN
REM Find the current bin directory from npm, storing the result in 'BIN'
@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 / README.md
Last active May 15, 2019 13:18
Webtask.io cron job for monitoring Chrome Extension reviews and support tickets (notifications sent through IFTTT)
@joeyespo
joeyespo / -sublime-text-3-settings.md
Last active August 20, 2018 04:40
Sublime Text 3 Settings (2018)

My Sublime Text 3 Settings

@joeyespo
joeyespo / README.html
Created February 6, 2015 06:28
Demonstrates how to use grip's API to export files without inlining GitHub's CSS, and an example of HTML output rendered from grip's README.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>README.md - Grip</title>
<link rel="icon" href="/grip-static/favicon.ico" /><link rel="stylesheet" href="/grip-cache/github-8f609688881a4249463fd5c6862df2e8a30b3f83dd00f6d08bbb07aeaa2b1851.css" />
<link rel="stylesheet" href="/grip-cache/github2-680b12df069daafad44834a7cfa6ee19c1239d3208aa6bcbe43f9cdaf55ae4e5.css" />
<style>
/* Page tweaks */
.preview-page {
@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"']
### Keybase proof
I hereby claim:
* I am joeyespo on github.
* I am joeyespo (https://keybase.io/joeyespo) on keybase.
* I have a public key whose fingerprint is 22EB 13A9 C8CE E5A5 77A7 8AF2 657E 9678 83E5 2DB5
To claim this, I am signing this object:
@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 / 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 / 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);
};