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
require('dotenv').config({ path: require('find-config')('.env') }); | |
const Koa = require('koa'); | |
const Router = require('koa-router'); | |
const koaLogger = require('koa-logger'); | |
const cors = require('@koa/cors'); | |
const bodyParser = require('koa-bodyparser'); | |
const serve = require('koa-static'); | |
const send = require('koa-send'); | |
const path = require('path'); | |
const session = require('koa-session'); |
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
{ | |
"dependencies": { | |
"@koa/cors": "^2.2.1", | |
"axios": "^0.18.0", | |
"bcrypt": "^2.0.0", | |
"bootstrap": "^4.1.0", | |
"classnames": "^2.2.5", | |
"dotenv": "^6.0.0", | |
"find-config": "^1.0.0", | |
"jquery": "^3.3.1", |
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
// | |
// Smooth scroll-to inspired by: | |
// http://stackoverflow.com/a/24559613/728480 | |
// | |
module.exports = function (scrollTo, scrollDuration) { | |
// | |
// Set a default for where we're scrolling to | |
// |
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 | |
}, | |
"plugins": ["react"], | |
"ecmaFeatures": { |
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
/** | |
* Flatten nested array | |
* @param {Array} array Nested array | |
* @return {Array} Flat array | |
*/ | |
function flatten(array) { | |
return array.reduce(function (flat, toFlatten) { | |
// if current item is array flatten it, otherwise concatenate value to processed flat array | |
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); |
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 gulp = require('gulp'); | |
var config = require('./config.json'); | |
var del = require('del'); | |
var svg2png = require('gulp-svg2png'); | |
var graphicsmagick = require('gulp-gm'); | |
... | |
gulp.src("./build/svg_files_" + colorName + "/*.svg") | |
.pipe(svg2png()) | |
.pipe(gulp.dest("./build/png_files_" + colorName)) |
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 DOMParser = require('xmldom').DOMParser; | |
var timestamp = require('console-timestamp'); | |
var config = require('./config.json'); | |
// open svg sprite file | |
fs.readFile(config.paths.svg_sprite, 'utf8', function (err, data) { | |
if (err) { | |
return console.log(timestamp('[hh:mm:ss] ') + "Read file " + config.paths.svg_sprite + " error: " + err); | |
} |
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
{ | |
"image": { | |
"color": "#BFBFBF", | |
"width": 36, | |
"height": 36 | |
}, | |
"paths": { | |
"svg_sprite": "./src/icons.svg" | |
} | |
} |
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 webpack = require('webpack'); | |
var merge = require('webpack-merge'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var NpmInstallPlugin = require('npm-install-webpack-plugin'); | |
var autoprefixer = require('autoprefixer'); | |
const TARGET = process.env.npm_lifecycle_event; | |
console.log("target event is " + TARGET); | |
var common = { |
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
let diff = require('immutablediff'); | |
shouldComponentUpdate(nextProps, nextState) { | |
let propsDiff = diff(this.props.data, nextProps.data); | |
if (propsDiff.size === 1) { | |
let operation = propsDiff.get(0).get("op"); | |
let replacedObj = propsDiff.get(0).get("value"); | |
switch (operation) { | |
case "replace": | |
if (Immutable.Map.isMap(replacedObj)) { |