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
age sex bmi children smoker region charges
19 female 27.9 0 yes southwest 16884.924
18 male 33.77 1 no southeast 1725.5523
28 male 33 3 no southeast 4449.462
33 male 22.705 0 no northwest 21984.47061
32 male 28.88 0 no northwest 3866.8552
31 female 25.74 0 no southeast 3756.6216
46 female 33.44 1 no southeast 8240.5896
37 female 27.74 3 no northwest 7281.5056
37 male 29.83 2 no northeast 6406.4107
@DungGramer
DungGramer / getDomainName.js
Last active March 2, 2022 12:02
getDomainName
function getDomainName(url) {
if (!/^http|https|wss|ssh|ftp/i.test(url)) {
url = `http://${url}`;
}
let { hostname } = new URL(url);
hostname = hostname.split(".").filter(Boolean);
function getSuffixIndex(hostname) {
const Icann = ["com", "net", "org", "edu", "gov", "mil", "int"];
Config NeoVim for Windows
@DungGramer
DungGramer / fastest_for.js
Last active October 16, 2023 06:40
Find fastest way to loop through an array in Javascript
const {performance} = require('perf_hooks');
// Create 1000 random numbers
const arr = length =>
Array.from({length}, () => Math.floor(Math.random() * 1000));
function record(arr) {
const result = [];
function timeRun(callback, message) {
@DungGramer
DungGramer / My Adguard Rule
Created April 26, 2022 09:46
My Adguard Rule
ybox.vn###app .article-right
ybox.vn###app .article-left
ybox.vn###app > div > div > div.page-container:nth-child(2) > div.page-content > div.content-wrapper > div.mt-20.spp-container > div.container-fluid.spp__content:nth-child(2) > div.post-detail > div.container-fluid.spp__content > div.row > div.col-sm-6.col-xs-12:nth-child(2) > div.d-flex.content.flex-column > div.panel > div.panel-body > div.mt-10.mb-10.hidden-xs:nth-child(6)

SCSS: Started with static website

SASS: What, why, and how?

SASS is a CSS preprocessor that is designed to be used as a standalone preprocessor, or as part of a framework called Compass.
SASS for CSS is very similar to CSS, for creating CSS files that are more easily readable and maintainable than traditional CSS files.
In the next chapper, we will learn how to use SASS to create a simple CSS file.

Setup Project

npm init -y
(() => {
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");
{
"version": "2.0.0",
"tasks": [
{
"label": "Run docker-compose",
"type": "shell",
"command": "docker compose up -d",
"windows": {
"command": "docker-compose up -d"
},
@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));
/**
@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
},