Skip to content

Instantly share code, notes, and snippets.

View brandonb927's full-sized avatar

Brandon Brown brandonb927

View GitHub Profile

Keybase proof

I hereby claim:

  • I am brandonb927 on github.
  • I am brandonb927 (https://keybase.io/brandonb927) on keybase.
  • I have a public key whose fingerprint is 8826 74F2 B591 348F B704 0CE6 5356 85E8 95E5 E538

To claim this, I am signing this object:

#!/bin/bash
# This script will delete *all* local and remote tags from any git repo you run
# it in, unless they are a major branch, or the most previous minor branches.
# If 1.4.3 is the latest patch/hotfix branch, all 1.*.* branchs will be deleted,
# but all major/minor releases will be left
#
# This script will not delete branches; just tags.
set -e
@brandonb927
brandonb927 / gist:b12b796dcbdec658708f
Last active May 4, 2016 13:30
Simple Client-side Error logging
<!--
From: https://metric.io/blog/2014/04/simple-client-side-error-logging
Stacktrace.js available from http://stacktracejs.com
-->
<script src="/static/js/stacktrace.js"></script>
<script>
window.onerror = function() {
var stackTrace;
@brandonb927
brandonb927 / gist:9587436
Created March 16, 2014 18:13
Simple JSON database with Node.JS

From: http://run-node.com/littlest-database-that-could/

I've written numerous tiny databases. They don't have much features, but they don't need much features. Usually I'm looking for fast simple key/value stores and Node never disappoints. The point here is, why abstract key value store when JS gives us one for free, as it's most basic component: object.

Will it meet every need? No. But it will meet ALOT of scenarios.

In memory JS object lookups, were talking hundreds of thousands of lookups (you'll easily flood http before the db), and save hundreds of thousands of records in a JSON file written to disk. Not a 200ms r/t to some hosted Redis. Hey, that's fine if that's your thing.

Here's the requirements:

import httplib
import base64
import contextlib
import simplejson
import urllib
from django.conf import settings
def stripe_fetch(resource, method='GET', params=None, secret=settings.STRIPE_SECRET, prefix='/v1'):
@brandonb927
brandonb927 / gist:6433230
Last active September 25, 2018 13:40
How to add Google Plus comments to your site. Paste this into your page and voila!
<script src="https://apis.google.com/js/plusone.js"></script>
<div id="comments"></div>
<script>
gapi.comments.render('comments', {
href: window.location,
width: '624',
first_party_property: 'BLOGGER',
view_type: 'FILTERED_POSTMOD'
});
</script>
@brandonb927
brandonb927 / new_gist_file
Created August 20, 2013 21:50
DisableYoutube Ads
document.cookie="VISITOR_INFO1_LIVE=oKckVSqvaGw; path=/; domain=.youtube.com";window.location.reload();
@brandonb927
brandonb927 / gist:5733117
Last active December 18, 2015 05:29
Pretty Git Log config courtesy of https://coderwall.com/p/euwpig
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
@brandonb927
brandonb927 / gist:5732192
Created June 7, 2013 20:30
Postach.io theme head tags. These tags are used in every theme and will constantly be updated to accommodate newer tags and tag updates over time.
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="description" content="{{ site.bio }} - {{ site.author }}" />
<meta name="copyright" content="Copyright (c) 2013 {{ site.author }}" />
<meta name="classification" content="blog" />
{% if is_post %}
<meta property="article:published_time" content="{{ post.created_at }}" />
@brandonb927
brandonb927 / rem.less
Created May 28, 2013 19:40
REM units mixin with PX fallback
/**
* REM units mixin with PX fallback for legacy browsers with no REM unit support
* https://github.com/christopher-ramirez/remixings
*/
// ===== REM UNIT MIXINS ====
@base-font-size-px: 16; // root's font size. @base-font-size-px MUST ME AN INTEGER.
@pxtorem-js-function: ~`pxtorem = function(px){ if (typeof rmxsBaseFontSize == 'undefined') rmxsBaseFontSize = @{base-font-size-px}; return (parseInt(px.replace(/(^\d+)(.+$)/i,'$1')) / rmxsBaseFontSize + 'rem') }`;
// ===== FONT MIXINS =====
.font-size(@value) {