Skip to content

Instantly share code, notes, and snippets.

@pablopaul
pablopaul / testing-react-components.js
Last active April 18, 2018 23:34 — forked from peduarte/testing-react-components.txt
Fix "ReferenceError: document is not defined" in jsdom + enzyme + ava environment.
/*
* Step 1
*/
npm install --save-dev jsdom
/*
* Step 2 (http://airbnb.io/enzyme/docs/guides/jsdom.html)
*
* test-browser-env.js
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@anhang
anhang / localStorage.js
Created July 20, 2011 23:07
HTML5 Local Storage with Expiration
AZHU.storage = {
save : function(key, jsonData, expirationMin){
if (!Modernizr.localstorage){return false;}
var expirationMS = expirationMin * 60 * 1000;
var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS}
localStorage.setItem(key, JSON.stringify(record));
return jsonData;
},
load : function(key){
if (!Modernizr.localstorage){return false;}