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
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv); |
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/bash | |
# @link https://gist.github.com/mattscilipoti/8424018 | |
# | |
# Called by "git push" after it has checked the remote status, | |
# but before anything has been pushed. | |
# | |
# If this script exits with a non-zero status nothing will be pushed. | |
# | |
# Steps to install, from the root directory of your repo... |
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/bash | |
GIT_REPO_URL=$(git config --get remote.origin.url) | |
mkdir .deploy | |
cp -R ./* .deploy | |
cd .deploy | |
git init . | |
git remote add github $GIT_REPO_URL | |
git checkout -b gh-pages | |
git add . |
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
<?php | |
// Turn on all error reporting so we can see if anything goes wrong | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(-1); | |
// Relative path to your wp-config.php file (to connect to the database) | |
require '../wp-config.php'; | |
require './frontmatter.php'; // Parses YAML frontmatter - https://github.com/Modularr/YAML-FrontMatter | |
require './Parsedown.php'; // Markdown parser - https://github.com/erusev/parsedown |
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
/** | |
* Shortcut function to create and return a DOM element | |
*/ | |
function domEl(tag: string, attributes: { [key: string]: any } = {}, children: any[] = []) { | |
const el = document.createElement(tag); | |
for (const attr in attributes) { | |
if (attr === 'text') { | |
el.appendChild(document.createTextNode(attributes[attr])); | |
continue; |
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
# Setup new React.js project | |
react_new() { | |
echo ">> Setting up NPM..."; | |
npm init -y; | |
echo ">> Running NPM install..."; | |
npm install --save react react-dom; | |
npm install --save-dev browserify babelify babel-preset-es2015 babel-preset-react fsmonitor; | |
echo ">> Setting up initial files..."; |
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 { GetServerSidePropsContext } from 'next'; | |
import React from 'react'; | |
import AuthLayout from 'src/layouts/AuthLayout'; | |
import AlertErrors from 'src/components/AlertErrors'; | |
import { addRequestBody } from 'src/server/bodyParser'; | |
import { userLogin, userSessionInsert } from 'src/server/queries'; | |
import { redirectUserToApp, setUserAuthCookie } from 'src/server/auth'; | |
import Link from 'next/link'; | |
// Types |
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 type { FormEvent } from 'react'; | |
export type onFormSubmit = (e: FormEvent, data: { [key: string]: any}) => void | |
export type ApiFormProps = { | |
children: any, | |
onSubmit: onFormSubmit, | |
[key: string]: any, // Allows any other props to be passed through to element | |
} | |
/** |
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
# x386 Architecture | |
export CFLAGS="-arch i386 $CFLAGS" | |
export CCFLAGS="-arch i386 $CCFLAGS" | |
export CXXFLAGS="-arch i386 $CXXFLAGS" | |
export LDFLAGS="-arch i386 $LDFLAGS" | |
# x64 Architecture | |
export CFLAGS="-arch x86_64 $CFLAGS" | |
export CCFLAGS="-arch x86_64 $CCFLAGS" | |
export CXXFLAGS="-arch x86_64 $CXXFLAGS" |
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
sheetQuery() | |
.from('Transactions') | |
.insertRows([ | |
{ | |
Amount: -554.23, | |
Name: 'BigBox, inc.' | |
}, | |
{ | |
Amount: -29.74, | |
Name: 'Fast-n-greasy Food Spot' |
NewerOlder