Skip to content

Instantly share code, notes, and snippets.

View DungGramer's full-sized avatar
🔥
React, JS

Nguyễn Công Dũng DungGramer

🔥
React, JS
View GitHub Profile
@DungGramer
DungGramer / input
Created October 27, 2022 08:37
cache index
[
{
"site_id": 1,
"hour": 8,
"dayofweek": 1,
"day": 21,
"month": 8,
"total": 363
},
{
export const createEnum = (keys, values, isUnique) => {
if (!keys) return {};
if (values === undefined || !Array.isArray(values)) {
if (Array.isArray(keys)) {
const enumObj = {};
for (const key of keys) {
enumObj[key] = isUnique ? Symbol(key) : key;
}
return Object.freeze(enumObj);
@DungGramer
DungGramer / All
Last active March 17, 2023 12:16
By-pass Ad SEO
// Minify
javascript:(()=>{const o=[`https://mneylink.com/load_traffic?r=${location.href}&w=${location.href}`,`https://traffic1s.com/get-codes?client_id=${t=(new Date).getTime(),window.performance&&"function"==typeof window.performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(o){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==o?n:3&n|8).toString(16)}))}&pathname=/&href=${location.href}/&hostname=${location.hostname}`];var t;const n=[];function e(o,t){for(const n of t)if(o[n])return o[n];for(const n in o)if("object"==typeof o[n]){const x=e(o[n],t);if(x)return x}}Promise.all(o.map((o=>fetch(o).then((o=>o.json()))))).then((o=>{o.forEach((o=>{const t=e(o,["html","code"]);t&&n.push(t)})),alert(n)}))})();
// Full
(() =>{
const url = [`https://mneylink.com/load_traffic?r=${location.href}&w=${location.href}`, `https://traffic1s.com/get-codes?pathname=/&href=${location.href}/&hostname=${location.hostname}`];
const result = [];
function findDeepKey
@DungGramer
DungGramer / gist:c6b16cf90abb39956135be82df29e1c0
Created April 9, 2023 03:31
Remove ward when choose state, remove state when choose province
let arr = [
{
name: 'P. PHÚC XÁ, Q. BA ĐÌNH, TP. HÀ NỘI',
provinceName: 'TP. HÀ NỘI',
provinceCode: '01',
stateName: 'Q. BA ĐÌNH',
stateCode: '001',
wardName: 'P. PHÚC XÁ',
wardCode: '00001',
},
// ==UserScript==
// @name Instant setInterval Execution
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
@DungGramer
DungGramer / main-alpha.js
Last active March 26, 2024 09:45
Run with very large data without out of memory
let loopRunning = true;
// Function to simulate resource-intensive task
function doTask() {
// Simulate a task that consumes memory
const array = new Array(10000).fill(
new Array(10000).fill(
new Array(10000).fill(
new Array(10000).fill(
new Array(10000).fill(
`[
{
"id": "0b6271d0-f98e-43f3-97df-175cc34b444b",
"type": "paragraph",
"props": {
"textColor": "default",
"backgroundColor": "default",
"textAlignment": "left"
},
"content": [