Skip to content

Instantly share code, notes, and snippets.

View ibreathebsb's full-sized avatar

Isaac Young ibreathebsb

View GitHub Profile
@ibreathebsb
ibreathebsb / vimrc.txt
Last active September 19, 2021 11:02
.vimrc
set path+=**
set relativenumber
set nu
set hidden
set nowrap
set smartindent
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set incsearch
const path = require('path')
const fs = require('fs')
const parser = require('@babel/parser')
const traverse = require('@babel/traverse').default
const root = path.resolve(__dirname, 'src')
const res = []
const impl = (asbPath, fn) => {
const stats = fs.statSync(asbPath)
function MinPQ() {
this.size = 0;
this.data = Array.from({ length: 10 });
}
MinPQ.prototype.swap = function (i, j) {
const tmp = this.data[i];
this.data[i] = this.data[j];
this.data[j] = tmp;
}
MinPQ.prototype.up = function (k) {
@ibreathebsb
ibreathebsb / edge.md
Last active January 26, 2025 14:49
open edge in terminal on macos
  1. open your .zshrc or .bashrc file

I'm using zsh so the command is vim ~/.zsh

  1. add an alias for edge

alias edge="/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge"

  1. open a new session, or run source ~/.zshrc(`source ~/.bashrc if you are using bash) to make the alias work
  2. type edge in the new session and press enter
@ibreathebsb
ibreathebsb / traverse.js
Created June 11, 2019 02:39
nodejs traverse directory
const fs = require("fs");
const path = require("path");
function traverse(current, cb) {
const stat = fs.statSync(current);
if (stat.isDirectory()) {
const files = fs.readdirSync(current);
files.forEach(file => {
const absPath = path.resolve(current, file);
traverse(absPath, cb);
@ibreathebsb
ibreathebsb / Dockerfile
Created May 28, 2019 08:12
docker npm scripts 没有运行
# --unsafe-perm
RUN npm i -g --unsafe-perm some-package
@ibreathebsb
ibreathebsb / android.sh
Last active October 24, 2020 04:15
android
adb shell settings get global device_name
adb shell settings put global device_name "Pixel-2L"
adb shell settings put global http_proxy 192.168.199.233:8888
local function Chinese()
-- 简体拼音
hs.keycodes.currentSourceID("com.apple.inputmethod.SCIM.ITABC")
end
local function English()
-- ABC
hs.keycodes.currentSourceID("com.apple.keylayout.ABC")
end
@ibreathebsb
ibreathebsb / git stash.md
Last active April 3, 2023 07:01
git stash 保存未跟踪文件

git stash

默认 git stash 仅会将已经跟踪的文件存储,当工作区有为跟踪文件时,使用git stash --include-untracked可以将所有文件存储起来。

@ibreathebsb
ibreathebsb / fix.js
Created November 22, 2018 04:58
安卓调整系统字体导致rem布局错乱
function calcREM() {
var docEl = document.documentElement;
var width = docEl.getBoundingClientRect().width;
var rem = width / 7.5;
rem = parseFloat(rem.toFixed(3));
docEl.style.fontSize = rem + 'px';
// 修正系统字体调整造成的布局问题
var realitySize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
if (rem !== realitySize) {
rem = rem * rem / realitySize;