This file contains hidden or 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
#!/bin/bash | |
# get script dir | |
if [ -L $0 ]; then | |
BASEDIR=$(dirname $(readlink $0)) | |
else | |
BASEDIR="$(cd "$(dirname "$0")" && pwd -P)" | |
fi | |
DIR="$BASEDIR/../dist" |
This file contains hidden or 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 { readdirSync, readFileSync } = require('fs') | |
const path = require('path') | |
const isGraphQLFile = fileName => fileName.endsWith('.graphql') | |
const readFile = fileName => readFileSync(path.join(__dirname, fileName), 'utf8') | |
const files = readdirSync(__dirname) | |
.filter(isGraphQLFile) | |
.map(readFile) |
This file contains hidden or 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 { isObject, isFunction } = require('lodash') | |
const { cond, identity, T } = require('ramda') | |
const makeDescriptor = cond([ | |
[isFunction, value => ({ get: value })], | |
[isObject, identity], | |
[T, value => ({ get: () => value })] | |
]) | |
/** |
This file contains hidden or 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 Joi = require('joi') | |
const ensureJoiSchema = schema => (req, res, next) => { | |
Joi.validate(req.body, schema, (err, value) => { | |
if (err) { | |
res.json(err, 400) | |
next(false) | |
return | |
} |
This file contains hidden or 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 dic = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | |
const randomInt = (max = 1000, min = 0) => Math.floor(Math.random() * (max - min)) + min | |
const randomString = () => dic.charAt(randomInt(dic.length -1, 0)) | |
const makeArray = (length, cb) => Array.from({ length }, cb) | |
const makeArrayOfStrings = length => makeArray(length, randomString) | |
const joiArr = lists => lists | |
.reduce((acc, arr) => { | |
return `${acc}${arr.join('')}` | |
}, '') |
This file contains hidden or 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
<script> | |
import c3 from 'c3' | |
import { debounce, cloneDeep, defaultsDeep } from 'lodash' | |
export default { | |
name: 'c3-chart', | |
props: { | |
config: { | |
type: Object, | |
default: () => ({}) |
This file contains hidden or 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
Show hidden characters
{ | |
"presets": [ | |
["env", { | |
"modules": false, | |
"targets": { | |
"browsers": "last 2 versions" | |
} | |
}], | |
"stage-2" | |
], |
This file contains hidden or 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 parseResponse = ({ data }) => { | |
if (data.error === true) { | |
return Promise.reject(data) | |
} | |
return data | |
} | |
const http = axios.create({ }) |
This file contains hidden or 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 { deburr, sortBy } from 'lodash' | |
const sanitizeAndLower = value => deburr(value).toLowerCase() | |
// | |
const sortByString = (list, key) => sortBy(list, x => sanitizeAndLower(x[key])) | |
const sortByName = list => sortByString(list, 'name') |
This file contains hidden or 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
xinput list --short | grep Logitech | awk '{print $5}' | cut -f2 -d"=" | xargs -I id xinput set-prop id "Device Accel Constant Deceleration" 0.4 |