Skip to content

Instantly share code, notes, and snippets.

View leafiy's full-sized avatar
🐖
Working from home

leafiy

🐖
Working from home
View GitHub Profile
@leafiy
leafiy / cloudSettings
Last active August 17, 2020 19:40
my-vscode-setting
{"lastUpload":"2020-08-17T19:40:11.375Z","extensionVersion":"v3.4.3"}
module.exports = {
white: [
{
featureType: "water",
elementType: "geometry",
stylers: [{ color: "#e9e9e9" }, { lightness: 17 }]
},
{
featureType: "landscape",
elementType: "geometry",
@leafiy
leafiy / extensions.json
Created February 7, 2019 07:50
vscode_syncing
[
{
"id": "AdamCaviness.theme-monokai-dark-soda",
"name": "theme-monokai-dark-soda",
"publisher": "AdamCaviness",
"version": "0.0.5"
},
{
"id": "dbaeumer.vscode-eslint",
"name": "vscode-eslint",
@leafiy
leafiy / babel.config.js
Last active December 21, 2018 18:37
fix $attr is readonly warning once for all
// add this to your bable config file
plugins: [
["module-resolver", {
"root": ["./"],
"alias": {
'vue': "./node_modules/vue/dist/vue.esm.js"
}
}]
]
@leafiy
leafiy / loading_spinners.css
Created September 2, 2018 20:55 — forked from davebra/loading_spinners.css
Simple gif loading spinners as data uri in css background
/* lightweight transparent background grey spinner */
element {
min-width: 32px;
min-height: 32px;
background-repeat: no-repeat;
background-image: url(data:image/gif;base64,R0lGODlhIAAgAPUAAP///15eXvv7+9nZ2fDw8PX19eHh4a2trb+/v/j4+O7u7vz8/Lm5ubKysuzs7NHR0cLCwvLy8svLy+jo6IWFhZSUlJqamqysrMfHx/Pz84yMjKKiomVlZV5eXt/f39vb2+bm5nl5eZmZmXBwcI2NjczMzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAG/0CAcEgkFjgcR3HJJE4SxEGnMygKmkwJxRKdVocFBRRLfFAoj6GUOhQoFAVysULRjNdfQFghLxrODEJ4Qm5ifUUXZwQAgwBvEXIGBkUEZxuMXgAJb1dECWMABAcHDEpDEGcTBQMDBQtvcW0RbwuECKMHELEJF5NFCxm1AAt7cH4NuAOdcsURy0QCD7gYfcWgTQUQB6Zkr66HoeDCSwIF5ucFz3IC7O0CC6zx8YuHhW/3CvLyfPX4+OXozKnDssBdu3G/xIHTpGAgOUPrZimAJCfDPYfDin2TQ+xeBnWbHi37SC4YIYkQhdy7FvLdpwWvjA0JyU/ISyIx4xS6sgfkNS4me2rtVKkgw0JCb8YMZdjwqMQ2nIY8BbcUQNVCP7G4MQq1KRivR7tiDEuEFrggACH5BAkKAAAALAAAAAAgACAAAAb/QIBwSCQmNBpCcckkEgREA4ViKA6azM8BEZ1Wh6LOBls0HA5fgJQ
@leafiy
leafiy / logger.js
Created July 14, 2018 18:46 — forked from xeoncross/logger.js
Expressjs Server Monitoring with Winston + Morgan
const { createLogger, format, transports } = require("winston");
// https://github.com/winstonjs/winston#logging
// { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }
const level = process.env.LOG_LEVEL || "debug";
function formatParams(info) {
const { timestamp, level, message, ...args } = info;
const ts = timestamp.slice(0, 19).replace("T", " ");
@leafiy
leafiy / mongodb_backup.md
Created May 21, 2018 09:52 — forked from baniol/mongodb_backup.md
MongoDB automatic backup

Maintaining even a small mongodb application in production requires regular backups of remotely stored data. MongoDB gives you three ways to acomplish it. In this post I'm using monogodump command for creating a backup and mongorestore for recreating the data. The purpose of this writing is to provide a simple way of periodic database dumps from a remote server to a Dropbox cloud storage.

Remember that for using mongodump you have to have a mongod process running.

Dumping a database

Suppose that you want make a backup of your books database.

To create a dump use mongodump -d books -o which will result in a book folder containing bson files with all collections.

$middle-width: 768px;
$large-width: 1024px;
@mixin middle {
@media (min-width: #{$middle-width}) and (max-width: #{$large-width - 1px}) {
@content;
}
}
@mixin large {
const anagrams = str => {
if (str.length <= 2) return str.length === 2 ? [str, str[1] + str[0]] : [str];
return str.split('').reduce((acc, letter, i) =>
acc.concat(anagrams(str.slice(0, i) + str.slice(i + 1)).map(val => letter + val)), []);
};
// anagrams('abc') -> ['abc','acb','bac','bca','cab','cba']
export const convertTimeHHMMSS = (val) => {
let hhmmss = new Date(val * 1000).toISOString().substr(11, 8)
return (hhmmss.indexOf('00:') === 0) ? hhmmss.substr(3) : hhmmss
}