Skip to content

Instantly share code, notes, and snippets.

@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@elidupuis
elidupuis / index.html
Created March 8, 2013 06:57
A CodePen by Eli Dupuis. Foundation block-grid - Foundation's block grids are awesome but they only work if all the elements are the same height. This SCSS snippet will allow the elements to be different heights. It works by simply clearing every nth element—based on how many columns you have. You can comment out the SCSS to see how the default …
<h1>Using both small and large grids</h1>
<ul class='small-block-grid-2 large-block-grid-4'>
<li><img src='http://placekitten.com/g/200/220' /></li>
<li><img src='http://placekitten.com/g/200/200' /></li>
<li><img src='http://placekitten.com/g/200/280' /></li>
<li><img src='http://placekitten.com/g/200/250' /></li>
<li><img src='http://placekitten.com/g/200/240' /></li>
<li><img src='http://placekitten.com/g/200/270' /></li>
<li><img src='http://placekitten.com/g/200/230' /></li>
@addyosmani
addyosmani / pubsub.js
Created December 5, 2012 16:04
Pub/Sub latest
/*
A basic implementation of the Publisher/Subscriber design pattern.
Developed by @addyosmani and @integralist
Example Usage:
// Create subscriber function to be called when topic publishes an event
var testSubscriber = function (topics, data) {
console.log(topics + ': ' + data);
};