Skip to content

Instantly share code, notes, and snippets.


Brandon Durham brandondurham

View GitHub Profile
brandondurham / gist:5e127344f3fea6be5f78442966837879
Created Jul 30, 2018
CSS: List using a counter that starts with “0” and uses “decimal-leading-zero”
View gist:5e127344f3fea6be5f78442966837879
/* CSS */
.Chapters {
column-count: 2;
counter-reset: toc -1;
.Chapter {
counter-increment: toc;
list-style-type: none;
brandondurham / Blog_decorator.js
Last active May 28, 2017
Higher-order component to ensure all static, same-domain links loaded from external sources use the router method
View Blog_decorator.js
// To use with your component as a decorator:
import React from 'react';
import styles from './styles.css';
import Internalize from 'components/InternalLinks';
export default class BlogContent extends React.Component {
static propTypes = {
content: PropTypes.static.isRequired
brandondurham / 0_reuse_code.js
Created Mar 8, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
brandondurham / swipeFunc.js
Last active Jun 20, 2016 — forked from localpcguy/swipeFunc.js
Updated swipe script for React
View swipeFunc.js
import React, { Component } from 'react';
import update from 'react-addons-update';
export default class App extends Component {
state = {
touches: {
touchstart: {
x: -1,
y: -1
View ScrollPanel.js
import React, {Component, PropTypes} from 'react';
import Hammer from 'react-hammerjs';
import classNames from 'classnames';
export default class ScrollPanel extends Component {
static propTypes = {
items: PropTypes.array,
menuStyle: PropTypes.string,
selectedItem: PropTypes.number,
brandondurham / styles.less
Last active Mar 13, 2021
Using Operator Mono in Atom
View styles.less
* Using Operator Mono in Atom
* 1. Open up Atom Preferences.
* 2. Click the “Open Config Folder” button.
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up.
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden!
* 5. Tweak away.
* Theme from the screenshot (
brandondurham / convert_spaces_to_tabs.sublime-macro
Last active Mar 17, 2020
Convert indentation from 2 spaces to tabs in Sublime Text
View convert_spaces_to_tabs.sublime-macro
// Convert 2 spaces to tabs in Sublime Text
// To add a key binding, go to "Sublime Text » Preferences » Key Bindings - User" and add the following line:
// { "keys": ["super+;"], "command": "run_macro_file", "args": {"file": "Packages/User/convert_spaces_to_tabs.sublime-macro"} }
// Change the `super+;` shortcut accordingly.
"args": {
"setting": "tab_size",
"value": 2
View Twitter: Unfollow everyone
__buttons__=jQuery(".content-main .user-actions-follow-button");
__interval__=setInterval(function () {
if (__cnt__ === __length__) {
alert("All done!");
View Twitter: Get names of all following
__username__=jQuery('.content-main .account-group');
__interval__=setInterval(function () {
if (__cnt__ === __length__) {
div = $('<div></div>');
brandondurham / font-stack mixin
Last active Dec 31, 2015
SASS Mixin for use with the Cloud.typography service.
View font-stack mixin
@mixin font-stack($family, $weight, $size: inherit, $line-height: inherit, $style: normal, $stack: '"Lucida Grande", "Lucida Sans", Verdana, Helvetica, Arial, sans-serif') {
@if $weight >= 6 { -webkit-font-smoothing: antialiased; } // Sharpen up the bold text
font: {
@if $style == normal {
family: "#{$family} #{$weight}r", "#{$family} A", "#{$family} B", unquote($stack);
@else if $style == italic {
family: "#{$family} #{$weight}i", "#{$family} A", "#{$family} B", unquote($stack);
size: $size;