Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Marin Călin iRealWorlds

🎯
Focusing
View GitHub Profile
@iRealWorlds
iRealWorlds / including.ts
Created Nov 11, 2020
Include files inside HTML, using a new custom tag, <include component="path">.
View including.ts
// Fix Array.from not being defined.
interface ArrayConstructor {
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
from<T>(arrayLike: ArrayLike<T>): Array<T>;
}
window.addEventListener("load", () => {
const needIncluding = Array.from(document.getElementsByTagName("include"));
for (const include of needIncluding) {
includeFile(include.getAttribute("component"), include);
@iRealWorlds
iRealWorlds / trees.js
Created Aug 1, 2020
A function that helps quickly create trees in javascript, with a minimum amount of HTML required.
View trees.js
const CreateTree = element => {
const clickEvent = new Event('click');
const openedClass = 'fa-minus-circle';
const closedClass = 'fa-plus-circle';
//initialize each of the top levels
element.classList.add('tree');
for (let child of element.querySelectorAll('li')) {
if (child.getElementsByTagName('ul').length) {
const newNode = document.createElement('i');
@iRealWorlds
iRealWorlds / ProgressBar.cs
Last active Mar 30, 2019 — forked from ikkentim/ProgressBar.cs
SA-MP progress bar converted to C#
View ProgressBar.cs
using SampSharp.GameMode;
using SampSharp.GameMode.Display;
using SampSharp.GameMode.SAMP;
using SampSharp.GameMode.World;
using System;
namespace YourNamespace
{
public class ProgressBar : IDisposable
{