Skip to content

Instantly share code, notes, and snippets.

View wowjeeez's full-sized avatar
💀
typescript god

Andris wowjeeez

💀
typescript god
View GitHub Profile
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
import EventEmitter from "node:events";
import { ServerEventEngine } from "./event.engine";
import { block, SourceExtraData } from "@msfx/runtime";
describe("server event engine test", () => {
const serverEmitter = new EventEmitter();
const clientEmitter = new EventEmitter();
beforeEach(() => {
global.onNet = (eventName: string, handler: Function) =>
@wowjeeez
wowjeeez / client.lua
Last active May 29, 2021 13:51
NUI focus toggler
local toggled = false
function notify(string)
SetNotificationTextEntry("STRING")
AddTextComponentString(string)
DrawNotification(true, false)
end
RegisterCommand("focus", function(_, args)
local curr = args[1] == "1" and true or false
toggled = curr

Keybase proof

I hereby claim:

  • I am wowjeeez on github.
  • I am wowjesus (https://keybase.io/wowjesus) on keybase.
  • I have a public key ASCGUdupHxIa1XezrHl6alUjZ3vckNh_7jGdgcl4gmkO-wo

To claim this, I am signing this object:

@wowjeeez
wowjeeez / main.js
Last active June 23, 2023 15:38
GTA 5 screen coords to HTML % (mainly used with FiveM nui)
function coordsToPerc(X, Y) {
const x = X * 100
const y = Y * 100
const style = `style="position:fixed; top:${this.location.y}%; left:${this.location.x}%"`
return {X: x, Y: y, CSS: style}
}
@wowjeeez
wowjeeez / vec.lua
Last active October 26, 2020 16:13
LUA snippet to calculate a point between 2 coords
function getPointOnLine(vec1, vec2, point) --the point on the line [point is always smaller then the distance between the 2 coords] (to get the coords on the center, just divide the distance with 2)
distance = #(vec1 - vec2) --distance
vec3 = vec1 + (point/distance) * (vec2 - vec1)
return vec3
end
--p: one-dimensional numner
@wowjeeez
wowjeeez / GTA-TrainVariations
Last active October 3, 2020 23:26
Contains all 23 train configurations used in gta5
PLEASE NOTE: I've recently discovered that there are more train variations, and some can be different from here
CONFIG: 0
freight
freightcar
CONFIG: 1
freight
freightcar
CONFIG: 2
freight
@wowjeeez
wowjeeez / deathevent.lua
Created August 27, 2020 16:01
not made by me
Citizen.CreateThread(function()
local isDead = false
local hasBeenDead = false
local diedAt
while true do
Wait(0)
local player = PlayerId()