Skip to content

Instantly share code, notes, and snippets.

Brandon Durham brandondurham

Block or report user

Report or block brandondurham

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
@brandondurham
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
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';
@Internalize
export default class BlogContent extends React.Component {
static propTypes = {
content: PropTypes.static.isRequired
@brandondurham
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
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
brandondurham / styles.less
Last active Jan 6, 2020
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 (http://cdn.typography.com/assets/images/blog/operator_ide2.png):
@brandondurham
brandondurham / convert_spaces_to_tabs.sublime-macro
Last active Aug 29, 2015
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
javascript:
__cnt__=0;
__buttons__=jQuery(".content-main .user-actions-follow-button");
__length__=__buttons__.length;
__interval__=setInterval(function () {
el=jQuery(__buttons__[__cnt__]);
if (__cnt__ === __length__) {
alert("All done!");
clearInterval(__interval__);
}
View Twitter: Get names of all following
javascript:
__cnt__=0;
__sep__="";
__username__=jQuery('.content-main .account-group');
__length__=__username__.length;
__usernames__='';
__interval__=setInterval(function () {
el=jQuery(__username__[__cnt__]);
if (__cnt__ === __length__) {
div = $('<div></div>');
@brandondurham
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;
You can’t perform that action at this time.