Skip to content

Instantly share code, notes, and snippets.

-- My first semi-complicated elm program after reading the first couple pages of the docs
-- I based this off of the text input example here (https://guide.elm-lang.org/architecture/text_fields.html) and used only the api documentation to figure the rest out
import Browser
import Html exposing (Html, Attribute, div, input, text)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
@edazpotato
edazpotato / getNumbersPercentageOfSum.js
Last active October 2, 2021 05:49
Takes an array of numbers and returns an array of numbers in the original order which represent the percentage each number is of the sum of all of the numbers.
function getNumbersPercentageOfSum(numbers, decimalPlaces = 2) {
let total = 0;
for (const number of numbers) {
total += number;
}
return numbers.map(number => ((number / total) * 100).toFixed(decimalPlaces));
}
// Code that enables discord experminets if you run it in the console
webpackJsonp.push([[999],{"l":(m,e,r)=>{for(k in r.c)(m=r.c[k].exports)&&m.default&&m.default.isDeveloper==0&&Object.defineProperty(m.default,"isDeveloper",{get:()=>1})}},[["l"]]])
@edazpotato
edazpotato / reload.js
Last active April 24, 2021 07:15
discord.js discord-akairo reload command that works on catergories as well as modules (commands) and has error handling!
const { Command } = require("discord-akairo");
class ReloadCommand extends Command {
constructor() {
super("reload", {
aliases: ["reload"],
args: [
{
id: "commandID",
default: "all"
@edazpotato
edazpotato / abbreviate-number.js
Created December 30, 2020 22:35 — forked from tobyjsullivan/abbreviateNum.js
Abbreviate large numbers in Javascript (as a es6 module)
export default function abbreviateNumber(value) {
let newValue = value;
const suffixes = ["", "K", "M", "B","T"];
let suffixNum = 0;
while (newValue >= 1000) {
newValue /= 1000;
suffixNum++;
}
newValue = newValue.toPrecision(3);

DM Server ads

Sorry, I don't accept unsolicited invites, and for your information they're a violation of the Discord Terms of Service. You can read more about the Terms of Service for Discord at https://discord.com/terms and contact me regarding any clarification you may require. Thank you!

Requests to buy your account

Sorry, I'm not willing to sell my account, and for your information doing so or asking someone to do so is a violation of the Discord Terms of Service. You can read more about the Terms of Service for Discord at https://discord.com/terms and contact me regarding any clarification you may require. Thank you!
@edazpotato
edazpotato / v-cloak.css
Last active September 22, 2020 01:19 — forked from matthewoestreich/v-cloak.css
v-cloak for vue.js loading
[v-cloak] {
visibility: hidden;
display: block;
padding: 50px 0;
}
@keyframes spinner {
to {
transform: rotate(360deg);
}
@edazpotato
edazpotato / bot-features.md
Last active September 22, 2020 00:16
Features that every discord bot should have
  • An Urban dictionary command
  • Reaction roles
  • A Purge command that defaults to 1
  • A Ban command
  • A Kick command
  • A Mute command
  • A Discord user info command
  • A Discord server info command
  • A Global ban report command
  • A Help command that's actually useful and dosen't DM you or have pages that you need to use reactions to scroll through

Keybase proof

I hereby claim:

  • I am edazpotato on github.
  • I am edaz (https://keybase.io/edaz) on keybase.
  • I have a public key whose fingerprint is 9EB6 941C 5AF5 ED66 5883 DF14 84D8 7E4D DD02 D50C

To claim this, I am signing this object: