Skip to content

Instantly share code, notes, and snippets.

View mrwest808's full-sized avatar
✌️

Johan West mrwest808

✌️
View GitHub Profile
import { ReactNode, useRef, useEffect } from 'react';
import { createPortal } from 'react-dom';
interface PortalProps {
children: ReactNode;
id: string;
}
export default function Portal({ children, id }: PortalProps) {
const elRef = useRef<HTMLElement>(null);
// CSGO Config
// Rates
rate "307200";
cl_cmdrate "128";
cl_updaterate "128";
cl_interp "0.0";
cl_interp_ratio "1";
cl_lagcompensation "1";
@mrwest808
mrwest808 / arrayToObject.js
Last active September 15, 2015 20:54
Reduce an array of objects into an object indexed on the specified property.
/**
* Reduce an array of objects into an object indexed on the specified property.
*
* @param {array} arr
* @param {string} prop
* @return {object}
*/
function toObject(arr, prop) {
return arr.reduce((acc, obj) => (
{...acc, [obj[prop]]: obj}
@mrwest808
mrwest808 / object-create-v1.js
Last active August 29, 2015 14:23
Object instantiation without `new` keyword
'use strict';
var inv = require('invariant'),
assign = require('lodash/object/assign'),
isObj = require('lodash/lang/isPlainObject'),
isFunc = require('lodash/lang/isFunction'),
toArray = require('lodash/lang/toArray');
/**
* Returns a function that creates a new object linked to the specified