This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stringToColor(string) { | |
let hash = 0; | |
let i; | |
for (i = 0; i < string.length; i += 1) { | |
hash = string.charCodeAt(i) + ((hash << 5) - hash); | |
} | |
let color = '#'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function ---------------------------------------------------------- | |
// ex: stringFormat("its like python{0} format", 3) ==> its like python3 format | |
export function stringFormat(string) { | |
[...Array(arguments.length)].forEach( | |
(_, i) => (string = string.replace("{" + (i - 1) + "}", arguments[i])) | |
); | |
return string; | |
} | |
// add to String prototype ------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dayjs from "dayjs"; | |
import { round, isNil } from "lib/utils"; // from lodash | |
import numeral from "numeral"; | |
numeral.register("locale", "vi", { | |
delimiters: { | |
thousands: ".", | |
decimal: ",", | |
}, | |
abbreviations: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias multipull="find . -mindepth 1 -maxdepth 1 -type d -print -exec git -C {} pull \;" | |
multipull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================================components/PickersActionBar.js============================================ | |
import { Button, Stack } from '@mui/material'; | |
import { useLocaleText } from '@mui/x-date-pickers/internals'; | |
export default function PickersActionBar({ onCancel, onAccept, disabled }) { | |
const { cancelButtonLabel, okButtonLabel } = useLocaleText(); | |
return ( | |
<Stack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getState = () => { | |
if (document.visibilityState === 'hidden') { | |
return 'hidden'; | |
} | |
if (document.hasFocus()) { | |
return 'active'; | |
} | |
return 'passive'; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set /p branch=Branch (master): | |
set /p git_command=Git command (fetch): | |
if "%branch%"=="" set branch=master | |
if "%git_command%"=="" set git_command=fetch | |
for /d %%i in (%cd%\*) do ( | |
echo ************************************************************************* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--text-gradient-stop-1: #4285f4; | |
--text-gradient-stop-2: #9b72cb; | |
--text-gradient-stop-3: #d96570; | |
--color-surface: #fff; | |
} | |
div { | |
background: linear-gradient( | |
74deg, | |
/* end here (2) */ var(--text-gradient-stop-1) 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name remove Hola VPN overlay | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-06-05 | |
// @description try to take over the world! | |
// @author You | |
// @match https://*.medium.com/* | |
// @match *://*/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=medium.com | |
// @grant none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
lai_suat_theo_ky_han = [ | |
{ | |
"ky_han": 1, | |
"lai_suat": 0.037 | |
}, | |
{ | |
"ky_han": 2, | |
"lai_suat": 0.038 |