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 { GoogleSpreadsheet } = require('google-spreadsheet'); | |
const fs = require('fs'); | |
const JSON_FILE_NAME = 'data.json' | |
const FILE_PATH = `/data/${JSON_FILE_NAME}` | |
const GOOGLE_SHEET_ID = '' | |
/* Create google credentials and save the credentials json file */ | |
const creds = require('./credentials.json') |
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
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
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
trailingComma: es5 | |
printWidth: 120 | |
tabWidth: 2 | |
useTabs: true | |
semi: false | |
bracketSpacing: true | |
jsxBracketSameLine: false | |
parser: typescript | |
singleQuote: true | |
requirePragma: false |
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 path = require('path') | |
module.exports = { | |
plugins: { | |
"postcss-import": { | |
resolve(id, basedir) { | |
// resolve alias @css, @import '@css/style.css' | |
// because @css/ has 5 chars | |
if (/^@css/.test(id)) { | |
return path.resolve('./src/assets/css', id.slice(5)) |
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 fs = require('fs'); | |
const util = require('util'); | |
const readFile = util.promisify(fs.readFile); | |
async function getFileLines() { | |
try { | |
const args = process.argv.slice(2) | |
if (!args.length) { | |
console.warn('>> Please pass file name as argument <<') |
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
{ | |
"workbench.colorTheme": "Material Theme Palenight", | |
"window.zoomLevel": -1, | |
"editor.insertSpaces": true, | |
"editor.wordWrap": "on", | |
"workbench.sideBar.location": "right", | |
"editor.fontSize": 15, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": 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
# List unique values in a DataFrame column | |
pd.unique(df.column_name.ravel()) | |
# Convert Series datatype to numeric, getting rid of any non-numeric values | |
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True) | |
# Grab DataFrame rows where column has certain values | |
valuelist = ['value1', 'value2', 'value3'] | |
df = df[df.column.isin(valuelist)] |
NewerOlder