Skip to content

Instantly share code, notes, and snippets.

View OhIAmFine's full-sized avatar
🐢
studying

xibaXIBAxibaba OhIAmFine

🐢
studying
  • Bytedance
  • chengdu
View GitHub Profile
@OhIAmFine
OhIAmFine / gist:cf912df831ab6d60d6592ea226c88337
Created May 12, 2021 02:18
show Window Performance Time Line
function showPerformanceTimeLine() {
const timing = window.performance.timing;
const temp = [];
for (let i in performance.timing) {
const val = performance.timing[i];
temp.push([i, val]);
}
const arr = temp.sort((a, b) => a[1] - b[1]);
const fs = require('fs');
const readline = require('readline');
const files = [];
let count = 1;
let store = new Set();
const startFolder = './src/pages/';
const goalFile = './src/locales/Order/en-US.js';
// find all js files
const readline = require('readline');
const fs = require('fs');
const readInterface = readline.createInterface({
input: fs.createReadStream('./messages.po'),
output: fs.createWriteStream('file.out'),
terminal: false,
console: false,
});
@OhIAmFine
OhIAmFine / changeAuthorCommit.txt
Last active December 18, 2023 16:26
change commit author in git
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="xxx.com"
CORRECT_NAME="OhIAmFine"
CORRECT_EMAIL="845782625@qq.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@OhIAmFine
OhIAmFine / flex-img-auto-reset
Created March 20, 2019 06:24
flex-img-auto-reset
import sadImageSrc from './sad.gif'
function TestImage () {
return (
<div style={{
width: '100%',
height: '100%',
display: 'flex',
flexDirection: 'column',
img{
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
// remove all container
docker rm -f $(docker ps -aq)
// start redis at localhost
docker run --name redis -p 6379:6379 -d redis
function formatDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;
return [year, month, day].join('-');