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 | |
# .git/hooks/post-checkout | |
# Utility to change AWS Amplify environments on branch checkout | |
# helper to get path to aws-exports.js | |
function get_aws_exports_path { | |
local AMPLIFY_PROJECT_CONFIG_PATH="amplify/.config/project-config.json" | |
local AMPLIFY_EXPORTS_PATH=$(jq -r '.javascript.config.SourceDir' $AMPLIFY_PROJECT_CONFIG_PATH) | |
if [[ "$AMPLIFY_EXPORTS_PATH" == */ ]] |
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
// src/pages/_app.js | |
import { Amplify, Auth } from 'aws-amplify' | |
import { | |
AmplifyAuthenticator, | |
AmplifySignUp, | |
AmplifySignIn, | |
AmplifySignOut, | |
} from '@aws-amplify/ui-react' | |
import config from '../aws-exports.js' |
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
function solution(N) { | |
// write your code in JavaScript (Node.js 8.9.4) | |
return parseInt(N >>> 0).toString(2).split('1').reduce((acc, value, index, self) => value.length > acc ? (typeof self[index + 1] === 'string' ? value.length : acc) : acc, 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 xlsx = require('xlsx') | |
module.exports = function parseWorkbook(file) { | |
const result = {} | |
console.info(`Parsing workbook ${file}`) | |
const wb = xlsx.readFile(file) | |
if (!wb.SheetNames.length) throw new Error('Invalid workbook, no sheets available.') | |
const extractDataWithHeaders = (data = {}) => { | |
const result = [] |
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
function _create_react_component | |
if test (count $argv) -lt 1 | |
read -l -P "Name of component? " component | |
_create_react_component $component | |
else | |
set cmp $argv[1] | |
mkdir -p components/$cmp | |
echo " | |
import React from 'react' | |
import styles from './$cmp.module.css' |
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
#!/usr/bin/env node | |
const { existsSync: exists, promises: fs } = require('fs'); | |
const { spawn } = require('child_process'); | |
const path = require('path'); | |
const c = require('chalk'); | |
const dotenv = require('dotenv'); | |
const nodemon = require('nodemon'); | |
// set default node_env | |
process.env.NODE_ENV = process.env.NODE_ENV || 'development'; |
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 fs from 'fs'; | |
import path from 'path'; | |
import express from 'express'; | |
const getFileRoutes = async ({ directory, ignore = /_/, include = /\.js$/ }) => { | |
const result = new Map(); | |
const nestedGetFiles = async nestedDirectory => { | |
const files = fs.readdirSync(nestedDirectory, { withFileTypes: true }); | |
for (let i = 0; i < files.length; i++) { | |
const f = files[i]; |
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
// | |
// utility to swap ZEIT Now configs | |
// unable to scope deploys to dev (team) with git enabled | |
// | |
// /.now | |
// |- now.swap.json | |
// |- project.json | |
// |- project.personal.json | |
// |- project.team.json | |
// |
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
{ | |
repository(name: "josefaidt.github.io", owner: "josefaidt") { | |
folder: object(expression: "master:app/content/pages") { | |
... on Tree { | |
entries { | |
oid | |
object { | |
... on Blob { | |
text | |
} |
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
# Lavandula | |
colors: | |
# Default colors | |
primary: | |
background: '0x040112' | |
foreground: '0x726f7c' | |
# Normal colors | |
normal: | |
black: '0x1e0543' |