Skip to content

Instantly share code, notes, and snippets.

Tommy Marshall tommymarshall

Block or report user

Report or block tommymarshall

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
@tommymarshall
tommymarshall / gist:11184530
Created Apr 22, 2014
Set Video Dimensions
View gist:11184530
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;
View Submit PR
# 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 Aug 29, 2015
Compares Underscore's extend method with React's merge helper.
View merge_extend.js
var merge = require('react/lib/merge');
var _ = require('underscore');
var a = {
name: 'Tommy',
specs: {
height: {
inches: 60,
feet: 6.085
},
View menu.html
<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>
View Preferences.sublime-settings
{
"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",
View fun.js
React.createClass({
componentDidMount: function() {
this.foo = 'bar';
},
componentWillUnmount: function() {
this.foo = null;
},
@tommymarshall
tommymarshall / _vertical_center.sass
Created Jun 6, 2014
Vertically centers a child element.
View _vertical_center.sass
=vertically-centered-child
font-size: 0
&:before
content: ''
display: inline-block
height: 100%
vertical-align: middle
> *
@tommymarshall
tommymarshall / thing.json
Created Jun 24, 2014
binds for aligning :, =, and =>
View thing.json
{
"keys": ["control+alt+;"], "command": "align_tab",
"args" : {
"user_input" : ":/f",
}
},
{
"keys": ["control+alt+="], "command": "align_tab",
"args" : {
View thing.js
var Floodlight = {
init: function() {
this.binds();
this.vars();
},
vars: function() {
this.$links = $('.fl-record-click')
@tommymarshall
tommymarshall / example.js
Last active Aug 29, 2015
Example of how to do things
View example.js
//= require_tree .
PROJECT.global.init();
// All the files in the tree here:
// global.js
var PROJECT = PROJECT || {};
You can’t perform that action at this time.