Skip to content

Instantly share code, notes, and snippets.

View tommymarshall's full-sized avatar

Tommy Marshall tommymarshall

View GitHub Profile
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 || {};
@tommymarshall
tommymarshall / RomanNumeralsConverter.php
Created August 25, 2014 19:17
Converts roman numerals to numbers.
<?php
class RomanNumeralsConverter
{
protected static $mappings = [
'I' => 1,
'V' => 5,
'X' => 10,
'L' => 50,
'C' => 100,
@tommymarshall
tommymarshall / .editorconfig
Created September 11, 2014 20:12
Editor Config
# http://EditorConfig.org
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
[*.json, *.js, *.html, *.erb, *.scss, *.sass, *.rb]
@tommymarshall
tommymarshall / sass.js
Created September 19, 2014 21:22
Sass task for running libsass
var gulp = require('gulp');
var sass = require('node-sass');
var handleErrors = require('../util/handleErrors');
var config = require('../config').sass;
var mkdirp = require('mkdirp')
var fs = require('fs')
var getDirName = require('path').dirname
var writeFile = function(path, contents){
mkdirp(getDirName(path), function(err){
@tommymarshall
tommymarshall / clean.sh
Last active August 29, 2015 14:07
Deletes all node_module folders in folders that are older than 120 days.
#!/bin/bash
# Sensible defaults
# So clean
clear
echo "Deleting all old node_modules folders..."
# Process things
find ${1:-'~/Sites'} -type d -mtime +120 -maxdepth 1 | while read line; do
@tommymarshall
tommymarshall / which_one.html
Created October 28, 2014 15:17
Simpler, always?
<!-- OPTION A -->
<article class="featured-home">
<figure class="featured-home__figure">
<img src="#TODO" alt="">
</figure>
<h4 class="featured-home__header">Poipu, Hawaii Sky</h4>
<footer class="featured-home__footer">
<p>from $199/Night</p>
</footer>
</article>