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
# Modified from: https://gist.github.com/playfulcorgi/4582f46e91d8ccaaf417341efb30d459 | |
# Set as cronjob every night at 1AM: | |
# crontab -e | |
# * 1 * * * /home/rw3iss/scripts/backup.sh | |
# backup.sh | |
export GOOGLE_DRIVE_SETTINGS="/home/rw3iss/scripts/.duplicity.credentials.yml" | |
export PASSPHRASE="YOUR_PASSWORD" |
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 isoFetch = jest.requireActual('isomorphic-fetch'); | |
const fetchMock = require('fetch-mock').sandbox(); | |
Object.assign(fetchMock.config, { | |
fetch: isoFetch | |
}); | |
fetchMock.config.fallbackToNetwork = true; | |
fetchMock.config.overwriteRoutes = 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
import 'jsdom-global/register'; | |
import { configure, mount } from 'enzyme'; | |
import { h } from 'preact'; | |
import Adapter from 'enzyme-adapter-preact-pure'; | |
configure({ adapter: new Adapter }); | |
jest.mock('isomorphic-fetch'); | |
const waitForPromises = () => new Promise(setImmediate) |
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 mkdirSync = function(dir) { | |
if (fs.existsSync(dir)) { | |
return; | |
} | |
try { | |
fs.mkdirSync(dir); | |
} catch(err){ | |
if(err.code == 'ENOENT'){ |
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 path = require("path"); | |
// Config params (relative to where npm/script is called from): | |
const APP_BASE = './src'; | |
const ENTRY_FILE = `index.tsx`; | |
const OUTPUT_DIR = './build'; | |
const OUTPUT_FILE = 'app.js'; | |
const IS_DEV = false; | |
const TARGET = 'es2018'; |
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
#!/bin/sh | |
tmux new-session -d | |
tmux split-window -h | |
tmux select-pane -t 0 | |
dir=$(PWD) | |
tmux send-keys -t 0 "cd client" Enter | |
tmux send-keys -t 0 "npm run dev" Enter |
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 envFilePlugin = { | |
name: 'env', | |
setup(build) { | |
function _findEnvFile(dir) { | |
if (!fs.existsSync(dir)) | |
return false; | |
let filePath = `${dir}/.env`; | |
if ((fs.existsSync(filePath))) { |
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
// Config: relative to where npm command is run: | |
const APP_BASE = 'src'; | |
const ENTRY_FILE = 'index.ts'; | |
const OUTPUT_DIR = 'build'; | |
const OUTPUT_FILE = 'app.js'; | |
const IS_DEV = true; | |
const TARGET = 'es2018'; | |
function build(entryFile, outFile) { | |
require('esbuild').build({ |
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 bs = require('browser-sync').create(); | |
const url = require('url'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const PORT = 3300 | |
const OUTPUT_DIR = './build' | |
const DEFAULT_FILE = "index.html" | |
bs.watch(`${OUTPUT_DIR}/**/*.js`, function (event, file) { |
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
import { ENV } from 'env'; | |
import fs from 'fs'; | |
import path from 'path'; | |
let prefix = './config/'; | |
let configFile = 'config.local.json'; | |
if (ENV == 'production') { | |
configFile = 'config.prod.json'; | |
} else if (ENV == 'development') { |