Skip to content

Instantly share code, notes, and snippets.

View HonbraDev's full-sized avatar

Honbra HonbraDev

View GitHub Profile
@HonbraDev
HonbraDev / formatTime.js
Created December 28, 2020 20:37
JavaScript - Go from a time in ms to human-readable
//go from a time in ms to human-readable
function formatTime(t){
var hrs = Math.floor(t / (1000*60*60));
t = t % (1000*60*60);
var mins = Math.floor(t / (1000*60));
t = t % (1000*60);
var secs = Math.floor(t / 1000);
t = padZeros((t % 1000).toString(), 3).substring(0, 2);
return padZeros(mins, 2) + ":" + padZeros(secs, 2) + '.' + t;
}
http://bobux.tommyinnitpoop.xyz/
@HonbraDev
HonbraDev / tsfiles.txt
Created March 13, 2021 01:08
List of TypeScript files in the DogeHouse front-end
./scripts/traverseTranslations.ts
./scripts/generateTranslationTypes.ts
./scripts/syncTranslations.ts
./src/generated/translationKeys.ts
./src/@types/react-datetime-picker.d.ts
./src/app/atoms.ts
./src/app/utils/showErrorToast.ts
./src/app/utils/useMeQuery.ts
./src/app/utils/useTokenStore.ts
./src/app/utils/dateFormat.ts
@HonbraDev
HonbraDev / alldogehouse.txt
Created March 13, 2021 01:14
All TypeScript of DogeHouse front-end combined
import React from "react";
import ReactDOM from "react-dom";
import * as Sentry from "@sentry/react";
import ReactModal from "react-modal";
import "react-toastify/dist/ReactToastify.css";
import "./index.css";
import { init_i18n } from "./i18n";
import { Providers } from "./Providers";
import { App } from "./app/App";
@HonbraDev
HonbraDev / koftawords.txt
Created March 13, 2021 01:46
All words in DogeHouse's Kofta TS files
from [768]
import [759]
const [596]
t [446]
d [441]
c [405]
div [376]
x [353]
v [335]
s [331]
@HonbraDev
HonbraDev / Message.ts
Last active March 18, 2021 12:47
Dogehouse Message type
type Message = {
userId: string;
tokens: { v: string; t: "text" | "mention" | string }[];
sentAt: string;
isWhisper: false;
id: string;
displayName: string;
avatarUrl: string;
};
@HonbraDev
HonbraDev / message.ts
Last active March 18, 2021 12:50
Message
const message = {
userId: '8f77004b-011d-4c6a-9104-05cbe843ab43',
tokens: [
{ v: 'wanted', t: 'text' },
{ v: 'to', t: 'text' },
{ v: 'suggest', t: 'text' },
{ v: 'a', t: 'text' },
{ v: 'API', t: 'text' },
{ v: 'documentation', t: 'text' },
{ v: 'tool', t: 'text' },
@HonbraDev
HonbraDev / coinflip.ts
Created March 19, 2021 15:28
CoinFlip
import { CommandInput } from "./CommandInput";
import { getUser, setMonies } from "../totallyARealDB";
import { addMessageToQueue } from "../queue";
export async function coinflip({ wrapper, msg, userId }: CommandInput) {
if (msg.tokens[1]) {
const user = getUser(userId);
const amount = parseInt(msg.tokens[1].v as string, 10);
if (typeof amount === "number") {
if (amount > 0) {
@HonbraDev
HonbraDev / PopularRooms.ts
Created March 20, 2021 10:51
DogeTracker popular rooms typing
export type PopularRooms = {
rooms: {
voiceServerId: string;
peoplePreviewList: {
numFollowers: number;
id: string;
displayName: string;
}[];
numPeopleInside: number;
name: string;
@HonbraDev
HonbraDev / firegresql.ts
Created March 25, 2021 17:09
FireGreSQL
import db from "../libs/database";
import { DBUserProfile } from "./types";
const getUser = (id: string): Promise<DBUserProfile> =>
new Promise((res, rej) =>
db
.ref("users")
.orderByChild("id")
.equalTo(id)
.once("value", (snap) => {