Skip to content

Instantly share code, notes, and snippets.

View DV8FromTheWorld's full-sized avatar
💭
Through code, all things are possible.

Austin Keener DV8FromTheWorld

💭
Through code, all things are possible.
View GitHub Profile
@DV8FromTheWorld
DV8FromTheWorld / vue-memoizer.js
Created November 16, 2021 20:56
Possible Vue Compostion Memoizer
/**
* Vue Composition HigherOrderFunction (HOF) that will take a Vue Composition function and return a
* memoized version of that function.
*
* A Memoized function in a function that, when given the same inputs, will skip any calculations done by the function
* and instead return a cached result that matches the inputs. This allows us to skip any duplicate computation
* or other calculations that would occur by calling the function from multiple places but with the same inputs.
*
* It is expected that the resolver function will take the provided inputs and convert them to a keyable value
* that can be used in the internal cache.
@DV8FromTheWorld
DV8FromTheWorld / JDAEntityMixins.md
Last active November 14, 2021 00:43
JDAEntityMixins.md

Entity Mixins

Entity Mixins are a system in JDA that provide the following core functionalities:

  • Code reuse through composition instead of purely through inheritence
  • A way to expose internal state setters and getters without exposing them to the library user

Example Mixin with Usage

//Publicly exposed entity api interface
public interface SomeEntity {
    String getName();
@DV8FromTheWorld
DV8FromTheWorld / SlashCommandConverter.java
Last active January 25, 2022 19:08
JDA SlashCommandConverter
/*
* Copyright 2021 Austin Keener
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@DV8FromTheWorld
DV8FromTheWorld / yarn.lock
Created June 22, 2021 15:18
Yarn lock file for vue3 infinite loop bug
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb"
integrity sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==
dependencies:
"@babel/highlight" "^7.14.5"
@DV8FromTheWorld
DV8FromTheWorld / switch-google-account.js
Last active May 5, 2021 20:19
Switch Google Account - Bookmark
;(() => {
/**
* User format where the user index is defined as part of the path as '/u/:userIndex/'
* This format is seen in google calendar.
* Example: https://calendar.google.com/calendar/u/1/r
**/
const formatUserInPath = {
getIndex() { return this._regex.exec(location.href)?.[1]; },
replace(index) { location.href = location.href.replace(this._regex, `/u/${index}/`); },
_regex: /\/u\/(.*?)\//
@DV8FromTheWorld
DV8FromTheWorld / Reverse Interview Questions.md
Created March 10, 2021 14:58
Reverse Interview Questions

Below is a collection of interview questions to ask the interview and the source from where I pulled them from

  • What are the biggest challenges I'll face in the first 90 days, and how will success be measured?
  • Is there anything about my background that makes you hesitant to move me forward in the interview process?
  • How does my background compare to other candidates you're interviewing?
  • I know the pandemic has caused unprecedented disruption for many companies. How are you, as a manager, doing?
  • Reflecting on your own experience, what have you seen the company do to promote diversity, equity and inclusion? Source
@DV8FromTheWorld
DV8FromTheWorld / get-css-rules.js
Created February 25, 2021 21:44
get-css-rules.js
/**
* Iterates through all stylesheets loaded onto the page and returns an array of all css rules.
* Useful for getter a quick glance at roughly how many css selector rules there are on a page.
*/
function getCssRules() {
const skipped = {}
const rules = Array.from(document.styleSheets)
.flatMap(sheet => Array.from(sheet.rules)
.flatMap(rule => {
const ruleType = rule.constructor.name
@DV8FromTheWorld
DV8FromTheWorld / alb-log-to-csv.js
Created January 11, 2021 17:56
AWS ALB access log file to CSV
const fs = require('fs')
const path = require('path')
const util = require('util')
const { exec } = require('child_process')
const fsPromises = fs.promises
const execPromise = util.promisify(exec)
const columnHeaders = ["type", "time", "elb", "client:port", "target:port", "request_processing_time", "target_processing_time", "response_processing_time", "elb_status_code", "target_status_code", "received_bytes", "sent_bytes", "request", "user_agent", "ssl_cipher", "ssl_protocol", "target_group_arn", "trace_id", "domain_name", "chosen_cert_arn", "matched_rule_priority", "request_creation_time", "actions_executed", "redirect_url", "error_reason", "target:port_list", "target_status_code_list", "classification", "classification_reason"]
@DV8FromTheWorld
DV8FromTheWorld / JDAEventTester.java
Last active July 31, 2021 01:40
JDA - Automated Event Firing
package net.dv8tion.jda.test;
//implementation "org.javassist:javassist:3.28.0-GA"
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.ProxyFactory;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.events.GenericEvent;
import net.dv8tion.jda.api.hooks.EventListener;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
@DV8FromTheWorld
DV8FromTheWorld / aws-google-login.sh
Last active May 21, 2020 19:54
Small bash script wrapper around aws-google-auth to provide easy (but overridable) defaults.
unset AWS_PROFILE
google_sso_idp=''
google_sso_sp=''
profile='default'
region='us-east-1'
# Put code into a function so that we can quick escape without using 'exit 1' considering
# if this code gets sourced into bash (which it should for proper usage) using 'exit 1' will kill the process.
function fn_aws_google_login() {