Skip to content

Instantly share code, notes, and snippets.

View nathggns's full-sized avatar

Nate Higgins nathggns

View GitHub Profile

TodoMVC React

module.exports = React.createClass({
displayName : 'LazyRender',
getInitialState() { return { props : this.props } },
componentWillReceiveProps(newProps) { setTimeout(() => this.setState(newProps), 10) },
shouldComponentUpdate(newProps, newState) { return this.state !== newState; },
render() { return React.cloneElement(React.Children.only(this.props.children), this.state); }
});
@nathggns
nathggns / jquery.shush.js
Last active December 25, 2015 02:49 — forked from cdl/jquery.shush.js
(function($) {
$.fn.shush = function($btn) {
// First, validation
// Cache global variables
var $form = $(this);
// Default $btn to input[type=submit]
$btn = $btn || 'input[type=submit]';
@nathggns
nathggns / dabblet.css
Created October 10, 2012 22:38 — forked from anonymous/dabblet.css
Untitled
* { padding: 0; margin: 0; }
body { background: #eeeeee; }
img {
-webkit-filter: grayscale(100%);
position: absolute;
top: 50%;
left: 50%;
margin-top: -150px;
margin-left: -150px;
-webkit-animation: down 1s ease, scale 1s ease .5s;
@nathggns
nathggns / dabblet.css
Created August 7, 2012 10:10 — forked from anonymous/dabblet.css
Untitled
* { padding: 0; margin: 0; box-sizing: border-box; /*(Needed to make content look nice with padding)*/ }
.header {
height: 60px;
background: grey;
}
.page {
position: absolute;
top: 60px;
bottom: 0;
/**
* @adamwhitcroft's "dot" effect in pure css. http://adamwhitcroft.com
* I made it as reall as possible, but the grid lines are darker, rather
* than the spaces between them, like in Adam's version.
* Compare to http://adamwhitcroft.com/wp-content/themes/Fifth/img/dot.png
*/
/* Make sure the image stays in it's container */
img { max-width: 100%; }
@nathggns
nathggns / dabblet.css
Created June 6, 2012 21:25 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* { padding: 0; margin: 0; box-sizing: border-box; }
body {
font-family: "Helvetica Neue", Arial, sans-serif;
background: #eee;
@nathggns
nathggns / dabblet.css
Created April 24, 2012 20:32 — forked from anonymous/dabblet.css
Fluid + Fixed divs
/**
* Fluid + Fixed divs
* To use this method, firstly you need to set the container's box-sizing
* to border-box. This method wil still work without it, but it helps
* to prevent a horizontal scrollbar that may exist due to the use
* of this method.
* Secondly, add a padding-right or padding-left (depending on
* where the sidebar is) of the width of your sidebar to the
* container. Also, add a relative position to it.
key: func1 func2 x, (->
doStuff()
)