Skip to content

Instantly share code, notes, and snippets.

Aaron Scherer aequasi

Block or report user

Report or block aequasi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aequasi
aequasi / AuthContext.tsx
Created May 16, 2019
Complex useContext Example (+useReducer)
View AuthContext.tsx
import {createContext, Dispatchm useReducer} from 'react';
import User from '../model/User';
interface State {
user?: User;
specialAwesomeFeature: boolean;
}
type Action =
@aequasi
aequasi / AuthContext.tsx
Last active May 16, 2019
Simple useContext example (+ useState)
View AuthContext.tsx
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;
View AbstractFields.tsx
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)) {
View gist:5eba0163fe411a019b807bdbc530f9ec
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.36"
},
"pages": [
{
"startedDateTime": "2018-12-01T05:42:24.899Z",
View log
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"
@aequasi
aequasi / git.bash
Created Oct 16, 2018
Handy git functions
View git.bash
pull() {
git pull ${1:-origin} ${2:-HEAD}
}
push() {
git push ${1:-origin} ${2:-HEAD}
}
@aequasi
aequasi / afssh
Last active May 22, 2018
Allows for SSHing (with tunnels) to any of the ansible inventories
View afssh
#!/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
View ChannelBuffer.ts
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) {
View long.php
<?php
/*
* This file is part of php-restcord.
*
* (c) Aaron Scherer <aequasi@gmail.com>
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE
*/
@aequasi
aequasi / main.js
Created Feb 9, 2017 — forked from izy521/main.js
Use CTRL + Enter to send a Discord Embedified message. You'll need to provide your account token to the code, on line 3. Will be removed if you refresh. Highlighting a selection of your message will let you send only that as the embed, and the rest as a normal message.
View main.js
(function start_embed_generator(window, document) {
var my_token = "-YOUR_TOKEN_HERE-";
var color_reg = /(\#.+?)(\s|$)/;
var text_bar_color = "rgb(92, 156, 199)";
window.addEventListener('keydown' , handle_event);
window.addEventListener('keyup' , revert_bar );
return !console.log("Embed generator up!");
You can’t perform that action at this time.