Skip to content

Instantly share code, notes, and snippets.

View mrampazz's full-sized avatar

Marco Rampazzo mrampazz

View GitHub Profile
@mrampazz
mrampazz / steamIDconverter.js
Created September 6, 2020 08:32
Small JS script to convert steamIDs
const BASE_NUM = 76561197960265728n;
const REGEX_STEAMID64 = /^[0-9]{17}$/;
const REGEX_STEAMID = /^STEAM_[0-5]:[01]:\d+$/;
const REGEX_STEAMID3 = /^\[U:1:[0-9]+\]$/;
const isSteamID64 = (id) => {
if (!id) {
return false;
}
return REGEX_STEAMID64.test(id);
@mrampazz
mrampazz / TableController.kt
Created September 30, 2020 09:31
Redux-react implementation kotlin
import actions.ToggleSideBar
import react.*
import react.redux.rConnect
import reducers.AppState
import redux.WrapperAction
private interface TableStateProps : RProps {
var isSideBarOpen: Boolean
}
@mrampazz
mrampazz / useEffectDebugger.ts
Created May 3, 2022 15:24
Hook to check which dep has changed on useEffect call
// usage: useEffectDebugger(callback, deps)
const usePrevious = (value: any, initialValue: any) => {
const ref = useRef(initialValue);
useEffect(() => {
ref.current = value;
});
return ref.current;
};