This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
// string generated by canvas.toDataURL() | |
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0" | |
+ "NAAAAKElEQVQ4jWNgYGD4Twzu6FhFFGYYNXDUwGFpIAk2E4dHDRw1cDgaCAASFOffhEIO" | |
+ "3gAAAABJRU5ErkJggg=="; | |
// strip off the data: url prefix to get just the base64-encoded bytes | |
var data = img.replace(/^data:image\/\w+;base64,/, ""); | |
var buf = new Buffer(data, 'base64'); | |
fs.writeFile('image.png', buf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const urlParser = url => { | |
const parser = document.createElement('a'); | |
parser.href = url; | |
return parser; | |
}; | |
const compareSearchParams = (p1, p2) => { | |
const urlParams1 = new URLSearchParams(p1); | |
const urlParams2 = new URLSearchParams(p2); | |
var keys1 = urlParams1.keys(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# editorconfig.org | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var path = '../file-sort/source'; | |
function readDir(path) { | |
var files = fs.readdirSync(path), modTime, folder; | |
for (var i in files) { | |
if (fs.lstatSync(path + '/' + files[i]).isDirectory()) { | |
readDir(path + '/' + files[i]); | |
} else { | |
modTime = fs.statSync(path + '/' + files[i]).mtime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
const SnackbarWrapper = (Component) => { | |
class Decorated extends React.Component { | |
constructor(props, context) { | |
super(props, context); | |
this.state = { | |
active: props.active | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"globals": { | |
"React": true | |
}, | |
"parserOptions": { |