Skip to content

Instantly share code, notes, and snippets.

Kyle Fox kylefox

Block or report user

Report or block kylefox

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
kylefox / stripe_subscription_coupons.rb
Created Jun 8, 2017
Inconsistent behavior between previewing subscription changes and saving subscription changes when removing subscription coupons.
View stripe_subscription_coupons.rb
# == Let's work with a subscription that has an existing coupon ==
subscription = Stripe::Subscription.retrieve('sub_ABC123') # => "early-upgrade"
# Preview invoice keeps the coupon, as expected.
customer: subscription.customer,
) # => "early-upgrade"
View spacing-scale.scss
$spacing-scale: (
default_app_config = 'cn.apps.users.config.UsersAppConfig'
View confirm.js
$(document).on('click', '.modal button.yes', function() {
console.log('You clicked yes!');
$(document).on('click', '.modal', function() {
console.log('You clicked no!');
kylefox /
Last active Aug 30, 2019
Run Django database migrations after deploy to Heroku. This file must live at `bin/post_compile` within your root project directory.
# !/usr/bin/env bash
# File path should be ./bin/post_compile
# (.sh extension added in Gist just to enable shell syntax highlighting.
echo "=> Performing database migrations..."
python migrate
View smiley.html
<!-- in head -->
body.clicked {
background: #7f1d26;
.smiley {
position: fixed;
top: 1rem;
right: 1rem;
width: 1rem;
from rest_framework_jwt.serializers import JSONWebTokenSerializer
from rest_framework.serializers import ValidationError
from rest_framework.authtoken.serializers import AuthTokenSerializer
from .models import LoginLockout
class LockableTokenSerializer(object):
In addition to the normal token auth validation,
kylefox / external.vanilla-forEach.js
Last active Feb 6, 2016 — forked from bastianallgeier/external.js
For those "external links should open in new tabs" clients…
View external.vanilla-forEach.js
// Array.forEach potentially faster than loop
var links = document.querySelectorAll('a[href*="//' + +'"]');
[] { = '_blank';

A proposal for a framework-agnostic way of building Javascript configuration objects based on different environments.

This proposal focuses on the conventions that will allow for the creation of a plain old JavaScript object. For example:

var environment = new Environment("development");; // "development"
environment.config.API_ROOT; // "http://localhost:3000/"
kylefox / gulpfile.js
Created Jan 15, 2016
I moved bower dependencies in my Ionic app from `./www/lib` to `./bower_modules` in order to slim down the resulting "www" package. Here are the gulp settings/tasks I use to compile/concatenate everything into `./www/js/libs.js`
View gulpfile.js
var paths = {
// Manually specify the bower resources we actually need.
// This way our index simply has: <script src="js/libs.js"></script>
bower: {
scripts: [
fonts: [
You can’t perform that action at this time.