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 / 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(
// ==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 / 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',
},
@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
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 / input
Created October 27, 2022 08:37
cache index
[
{
"site_id": 1,
"hour": 8,
"dayofweek": 1,
"day": 21,
"month": 8,
"total": 363
},
{
@DungGramer
DungGramer / settings.json
Created September 23, 2022 09:53
Better comments + todo tree
"better-comments.tags": [
{
"tag": "- [x]",
"color": "#6a6758",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
@DungGramer
DungGramer / sorter.js
Created September 19, 2022 04:22
Mini Sorter function
import moment from 'moment';
/**
* @param {string} dateA - a date, represented in string format
* @param {string} dateB - a date, represented in string format
*/
const date = (dateA, dateB) => moment(dateA).diff(moment(dateB));
/**
{
"version": "2.0.0",
"tasks": [
{
"label": "Run docker-compose",
"type": "shell",
"command": "docker compose up -d",
"windows": {
"command": "docker-compose up -d"
},
(() => {
let gridSystem = document.querySelector("#grid-system");
if (gridSystem) {
gridSystem.remove();
document.querySelector('#grid-controller').remove();
return;
}
const grid = document.createElement("article");
grid.id = "grid-system";
let style = document.createElement("style");