Skip to content

Instantly share code, notes, and snippets.

@a-marquez
a-marquez / ValuePre.js
Last active May 4, 2018 05:59
React utility to pretty print a value in a pre element, npm install gist:1e420e5b30911e7758356718fbf91341
import React from 'react'
const ValuePre = ({value}) => React.createElement(
'pre',
[],
[JSON.stringify(value, null, 2)]
)
export default ValuePre
@a-marquez
a-marquez / .gitignore
Created January 22, 2018 21:16 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};