Skip to content

Instantly share code, notes, and snippets.

View tommymarshall's full-sized avatar

Tommy Marshall tommymarshall

View GitHub Profile
@tommymarshall
tommymarshall / gist:11184530
Created April 22, 2014 15:55
Set Video Dimensions
setVideoDimensions: function() {
var $wrapper = $('.video-wrapper');
var $video = $('.video');
var height = $wrapper.height();
var width = $wrapper.width();
// Maintain 16 / 9 aspect ratio
if (width / height > 16 / 9) {
newWidth = height / 9 * 16;
newHeight = height;
# Submit PR for current branch against master
pr () {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
}
@tommymarshall
tommymarshall / merge_extend.js
Last active August 29, 2015 14:01
Compares Underscore's extend method with React's merge helper.
var merge = require('react/lib/merge');
var _ = require('underscore');
var a = {
name: 'Tommy',
specs: {
height: {
inches: 60,
feet: 6.085
},
@tommymarshall
tommymarshall / menu.html
Last active August 29, 2015 14:01
Basic menu.
<header>
<nav>
<ul>
<li>
<div>
<h3>Heading</h3>
<ul>
<li><a href="#">Some link</a></li>
<li><a href="#">Some link</a></li>
<li><a href="#">Some link</a></li>
{
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
"detect_indentation": true,
"draw_centered": true,
"draw_white_space": "all",
"folder_exclude_patterns":
[
"tmp/cache/assets/development",
React.createClass({
componentDidMount: function() {
this.foo = 'bar';
},
componentWillUnmount: function() {
this.foo = null;
},
@tommymarshall
tommymarshall / _vertical_center.sass
Created June 6, 2014 17:58
Vertically centers a child element.
=vertically-centered-child
font-size: 0
&:before
content: ''
display: inline-block
height: 100%
vertical-align: middle
> *
@tommymarshall
tommymarshall / thing.json
Created June 24, 2014 18:59
binds for aligning :, =, and =>
{
"keys": ["control+alt+;"], "command": "align_tab",
"args" : {
"user_input" : ":/f",
}
},
{
"keys": ["control+alt+="], "command": "align_tab",
"args" : {
var Floodlight = {
init: function() {
this.binds();
this.vars();
},
vars: function() {
this.$links = $('.fl-record-click')
@tommymarshall
tommymarshall / example.js
Last active August 29, 2015 14:04
Example of how to do things
//= require_tree .
PROJECT.global.init();
// All the files in the tree here:
// global.js
var PROJECT = PROJECT || {};