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
{ | |
"name": "Custom npm init", | |
"version": "0.0.0", | |
"decription": "A test project, to demonstrate a custom npm init script.", | |
"main": "index.js", | |
"keywords": [], | |
"author": "Joe Bloggs <[email protected]> (joebloggs.com)", | |
"license": "ISC", | |
"repository": { | |
"type": "git", |
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 { execSync } = require('child_process'); | |
function run(func) { | |
console.log(execSync(func).toString()) | |
} | |
module.exports = { | |
name: prompt('package name', basename || package.name), | |
version: prompt('version', '0.0.0'), | |
decription: prompt('description', ''), |
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 scrapeNumber = 20; | |
const scrapeQuery = '.userContentWrapper'; | |
const startTime = Date.now(); | |
const lapseTime = 3600000; // that's 1 hour in milliseconds | |
let arrayOfItems = []; | |
let heightBefore = 0; | |
let heightAfter = 0; | |
while (arrayOfItems.length < scrapeNumber) { | |
await page.evaluate('window.scrollTo(0, document.body.scrollHeight)'); |
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 React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
const containerStyle = { | |
display: 'flex' | |
} | |
const buttonStyle = { | |
fontSize: '1.5rem', | |
width: '40px', | |
height: '40px' |
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
{ | |
"version": "1.0.0", | |
"description": "", | |
"main": "./src/index.js", | |
"scripts": { | |
"electron": "electron src", | |
"start": "cross-env NODE_ENV=dev nodemon --watch ./src/**/* --watch . --exec 'npm run electron'" | |
}, | |
"keywords": [], | |
"author": "", |
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 { app, BrowserWindow } = require('electron'); | |
// Keep a global reference of the window object, if you don't, the window will | |
// be closed automatically when the JavaScript object is garbage collected. | |
let win; | |
function createWindow() { | |
win = new BrowserWindow({ | |
width: 800, | |
height: 600, |
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
{ | |
"name": "renderer", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"react": "^16.8.6", | |
"react-dom": "^16.8.6", | |
"react-scripts": "3.0.1" | |
}, | |
"scripts": { |
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
{ | |
"name": "desktop-app", | |
"version": "1.0.0", | |
"main": "index.js", | |
"scripts": { | |
"start": "concurrently \"(cd renderer && npm run start && cd ..)\" \"(cd main && npm run electron && cd ..)\"" | |
}, | |
"license": "ISC", | |
"devDependencies": { | |
"concurrently": "^4.1.0" |
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 { google } = require('googleapis'); | |
const fs = require('fs'); | |
const credentials = require('./credentials.json'); | |
const scopes = [ | |
'https://www.googleapis.com/auth/drive' | |
]; | |
const auth = new google.auth.JWT( |
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 { google } = require('googleapis'); | |
const fs = require('fs'); | |
const credentials = require('./credentials.json'); | |
const scopes = [ | |
'https://www.googleapis.com/auth/drive', | |
'https://www.googleapis.com/auth/spreadsheets', | |
]; |