Skip to content

Instantly share code, notes, and snippets.

View doraemonxxx's full-sized avatar
:octocat:
Toxic and Hypocrite

mew doraemonxxx

:octocat:
Toxic and Hypocrite
View GitHub Profile
@doraemonxxx
doraemonxxx / leaflet-google.js
Created February 22, 2024 08:06 — forked from crofty/leaflet-google.js
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
@doraemonxxx
doraemonxxx / CheckPermission.js
Created June 30, 2022 21:03
simple react or vanilla js permission checking
import { USER_INFO } from '../../redux/Authenticate/reducer';
import { useSelector } from 'react-redux';
import { cloneDeep, each, omit } from 'lodash';
const APP_USER = {
jsecalias: [],
permission: [],
allPermitted: false,
cache: {},
@doraemonxxx
doraemonxxx / CheckPermission.ts
Created June 30, 2022 21:01
simply check user permission - for private project
function hasRealPermission(p: string): boolean {
const permission = userPermission;
let allPermitted = false;
const cache = {};
function getCA(perm: string): CA | null {
const p = perm?.split(/:/);
if (p?.length < 2) {
return null;
}
if (p) {
class benchmark {
private $startTime;
private $endTime;
private $totalOps;
private $opsCompleted;
private $intervalOpsCompleted;
private $benchInterval; //how far back in seconds the bench should look to calc
private $lastBench; //time last bench was calculated