Skip to content

Instantly share code, notes, and snippets.

View ryanhaticus's full-sized avatar
🔥
burning down production

Ryan Huellen ryanhaticus

🔥
burning down production
View GitHub Profile
import 'react';
declare module 'react' {
namespace JSX {
interface IntrinsicElements {
// Autocomplete
'el-autocomplete': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
'el-autocomplete-input': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
'el-autocomplete-item': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
@ryanhaticus
ryanhaticus / classToObjectAndObjectToClass.ts
Created September 15, 2021 22:45
Wrote this code to turn class instances with getters and setters into objects and back. Uses the dangerous eval() function. No current straightforward way to do this in JavaScript or TypeScript. Here's my implementation.
const setClassFromObject = (object: any, instance: any) => {
Object.keys(object).forEach((key) => {
eval(`instance.${key} = object[key]`);
});
};
const getObjectFromClassInstance = <T>(instance: any): any => {
const keys = Object.getOwnPropertyNames(Object.getPrototypeOf(instance))
.map((key) => [
key,
@ryanhaticus
ryanhaticus / controls.json
Created September 10, 2021 21:34
A formatted list of FiveM controls featuring a control index (id), name, qwerty key, and controller button. Curated by Haticus @ store.haticus.com for free use.
[
{
"controlIndex": 0,
"name": "INPUT NEXT CAMERA",
"qwerty": "V",
"controller": "BACK"
},
{
"controlIndex": 1,
"name": "INPUT LOOK LR",
@ryanhaticus
ryanhaticus / UpdatingYamlConfiguration.java
Created April 10, 2020 20:08
An updating YamlConfiguration wrapper for Spigot plugins.
package me.view.anchorbans.data;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
<form id="thwSearchForm" name="searchform" target="_blank" method="get" action="http://www.teenhealthandwellness.com/search"><table border="0" cellspacing="0" style="border:1px solid #000000;"><tbody><tr><td bgcolor="#6699CC"><span style="font-size:.2em;"> </span></td></tr><tr><td><img src="http://teenhealthfiles.rosenpub.com/misc/logo_small.gif" width="270" height="36" style="margin:4px;" /></td></tr><tr><td align="center" valign="middle" style="background-color: #dddddd;"><span style="padding:4px;font-family:Arial;font-size:.7em;vertical-align:middle;"><label for="q">Search: </label><input name="q" type="text" id="q2" style="font-size:.9em;border:1px solid #678;vertical-align:middle;" /><input value="GO" type="submit" style="background: #fff url(http://www.teenhealthandwellness.com/images/bg_input-button.jpg) repeat-x 0 0;font-size:.8em;font-weight:bold;color: #efefef;" onclick="this.form.submit();" name="s" /></span></td></tr><tr><td bgcolor="#006699"><span style="font-size:.2em;"> </span></td></tr></tbody
<form id="thwSearchForm" method="post" name="searchform" onsubmit="function x(e) { var link = 'http://www.teenhealthandwellness.com/search?q=' + document.getElementById('q2').value.toString().replace(/\s/g, '+'); var w = window.open(link, '_blank'); w.focus(); return false;};x('e');"><table border="0" cellspacing="0" style="border:1px solid #000000;"><tbody><tr><td bgcolor="#6699CC"><span style="font-size:.2em;"> </span></td></tr><tr><td><img src="http://teenhealthfiles.rosenpub.com/misc/logo_small.gif" width="270" height="36" style="margin:4px;" /></td></tr><tr><td align="center" valign="middle" style="background-color: #dddddd;"><span style="padding:4px;font-family:Arial;font-size:.7em;vertical-align:middle;"><label for="q">Search: </label><input name="q" type="text" id="q2" style="font-size:.9em;border:1px solid #678;vertical-align:middle;" /><input value="GO" type="submit" style="background: #fff url(http://www.teenhealthandwellness.com/images/bg_input-button.jpg) repeat-x 0 0;font-size:.8em;font-weight:b