Skip to content

Instantly share code, notes, and snippets.

View cryptiklemur's full-sized avatar

Aaron Scherer cryptiklemur

View GitHub Profile
const {ContextReplacementPlugin} = require('webpack');
const {join} = require('path');
require('dotenv').config({path: join(__dirname, '.env.build')});
const withImages = require('next-images');
const withSass = require('@zeit/next-sass');
const withSourcemaps = require('@zeit/next-source-maps')();
const isProd = process.env.NODE_ENV === 'production';
const ident = isProd ? '[hash:base64:5]_[local:base64:5]' : '[name]_[local]';

Keybase proof

I hereby claim:

  • I am aequasi on github.
  • I am aequasi (https://keybase.io/aequasi) on keybase.
  • I have a public key ASBhuAwo0Ek_FCTtgCssp1I8EiLEikCciABqxH31IFnsXQo

To claim this, I am signing this object:

@cryptiklemur
cryptiklemur / AuthContext.tsx
Created May 16, 2019 16:06
Complex useContext Example (+useReducer)
import {createContext, Dispatchm useReducer} from 'react';
import User from '../model/User';
interface State {
user?: User;
specialAwesomeFeature: boolean;
}
type Action =
@cryptiklemur
cryptiklemur / AuthContext.tsx
Last active June 26, 2020 23:47
Simple useContext example (+ useState)
import {createContext, useState} from 'react';
import User from '../model/User'; // Random User Model
interface Context {
user?: User;
setUser?: (user: User) => void;
}
const initialState: User = null;
type newable<T> = new (cls: newable<T>) => T;
export default abstract class AbstractFields<T extends AbstractFields<any>> {
protected constructor(protected readonly cls: newable<T>) {
}
public with(property: keyof T & string, value: string | number): T {
const newInstance: T = new this.cls(this.cls);
for (const [k, v] of Object.entries(this)) {
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2018-12-01T05:42:24.899Z",
This file has been truncated, but you can view the full file.
2018/11/21 01:01:52 [WARN] Invalid log level: "1". Defaulting to level: TRACE. Valid levels are: [TRACE DEBUG INFO WARN ERROR]
2018/11/21 01:01:52 [INFO] Terraform version: 0.11.10 17850e9a55d33c43d7c31fd6ac122ba97a51d899
2018/11/21 01:01:52 [INFO] Go runtime version: go1.11.1
2018/11/21 01:01:52 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2018/11/21 01:01:52 [DEBUG] Attempting to open CLI config file: /Users/aaron/.terraformrc
2018/11/21 01:01:52 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/11/21 01:01:52 [INFO] CLI command args: []string{"apply"}
2018/11/21 01:01:52 [TRACE] module source: "git@github.com:sctr/terraform-modules.git//modules/project-deployment"
2018/11/21 01:01:52 [TRACE] module source: "git@github.com:sctr/terraform-modules.git//modules/ecs-codepipeline"
2018/11/21 01:01:52 [TRACE] module source: "github.com/cloudposse/terraform-terraform-label.git?ref=0.1.2"
@cryptiklemur
cryptiklemur / git.bash
Created October 16, 2018 22:19
Handy git functions
pull() {
git pull ${1:-origin} ${2:-HEAD}
}
push() {
git push ${1:-origin} ${2:-HEAD}
}
@cryptiklemur
cryptiklemur / afssh
Last active May 22, 2018 19:04
Allows for SSHing (with tunnels) to any of the ansible inventories
#!/bin/bash
directory=~/projects/php-nginx-wp-ansible
if [[ "$2" != "dbservers" && "$2" != "webservers" ]]; then
echo ""
echo "$2 is not a valid type. Pass either dbservers or webservers"
exit
fi
import {Mutex} from "await-semaphore";
import {Channel} from "eris";
import {setInterval} from "timers";
const mutex: Mutex = new Mutex();
export default class ChannelBuffer<T> {
private _messages: T[] = [];
constructor(private _channel: Channel, tick: Function, interval: number = 1000) {