Skip to content

Instantly share code, notes, and snippets.

View brandonb927's full-sized avatar

Brandon Brown brandonb927

View GitHub Profile
@brandonb927
brandonb927 / example.less
Last active December 15, 2017 20:02 — forked from ddemaree/_retina.scss
Retina font-weight for thin fonts in HiDPI typography
@import "retina.less";
.body-text {
.retina-font-weight();
}
@brandonb927
brandonb927 / timeline.html
Created May 11, 2013 21:43
Postach.io Theme - Timeline
<!DOCTYPE hl>
<html lang="en-US" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="utf-8" />
<title>{% if is_home %} {{ site.author }} {% elif is_post %} {{ post.title }} {% elif is_link %} {{ link.title }} {% elif is_tag %} {{ tag }} {% elif is_page %} {{ page.title }} {% endif %} | {{ site.name }}</title>
<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" />
@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) {
@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 / 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 / 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: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>
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: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:

@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;