Skip to content

Instantly share code, notes, and snippets.

View Gaubee's full-sized avatar
🫐
Growing

Gaubee Gaubee

🫐
Growing
View GitHub Profile
commit 7a78c009c4b073f90b97d9111b14ffd84662fb5e
Author: Gaubee <[email protected]>
Date: Thu Dec 28 13:12:27 2023 +0800
:bug: [kmp/core] 修复IpcBodySender的from函数延迟赋值metaBody的问题
commit 40d88f0face4e374ffcae31992205fcda12e741f
Author: jackie-yellow <[email protected]>
Date: Thu Dec 28 09:45:23 2023 +0800

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

@Gaubee
Gaubee / bin2hex.js
Last active February 5, 2020 16:23
取代cookie的网站追踪技术:”帆布指纹识别”初探
function bin2hex (bin)
{
var i = 0, l = bin.length, chr, hex = '';
for (i; i < l; ++i)
{
chr = bin.charCodeAt(i).toString(16)
hex += chr.length < 2 ? '0' + chr : chr
}
return hex
}

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装
@Gaubee
Gaubee / account.chain.ts
Last active May 18, 2018 08:42
使用数组来链式记录账户的余额
import { MongoClient } from 'mongodb';
const url = 'mongodb://localhost:27017';
const dbName = 'test-set';
import { ConsolePro } from "console-pro";
const console = new ConsolePro();
/**等待n毫秒 */
function sleep(ms: number) {
return new Promise(cb => setTimeout(cb, ms));
}
@Gaubee
Gaubee / remove-term-color.js
Created May 16, 2018 09:56
remove terminal color.
const color_flag_reg = /((\u001b\[\d+m)+)([\s\S]+?)((\u001b\[\d+m)+)/;
s.replace(color_flag_reg, "$3");
@Gaubee
Gaubee / worker.example.js
Last active January 11, 2018 00:50
separate read and write 读写分离
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cluster = require("cluster"); // const cluster = require("cluster")
const os = require("os"); // const os = require("os")
/* Share code */
const prepare_job_promise = new Promise((resolve, reject) => {
// bootstrap modules
setTimeout(resolve, 1000);
});
// or write like this
@Gaubee
Gaubee / keyboard-attach.ts
Last active November 3, 2017 05:12
ionic2+更好地处理软键盘弹出的方案
import { Directive, ElementRef, Input } from '@angular/core';
import { Content, Platform } from 'ionic-angular';
import { Keyboard } from '@ionic-native/keyboard';
import { Subscription } from 'rxjs/rx';
/**
* @name KeyboardAttachDirective
* @description
* The `keyboardAttach` directive will cause an element to float above the
* keyboard when the keyboard shows. Currently only supports the `ion-footer` element.
@Gaubee
Gaubee / PromisePool.js
Created October 29, 2017 02:35
JS实现+=/-=操作符号的重载
// __op_temp_null_: 说明缓存取中没有东西
Object.defineProperty(global, "__op_temp_null_", {
value: Symbol("Operators Object NULL")
});
const op_temp_key = Symbol("Operators Object TEMP");
Object.defineProperty(global, "__op_temp__", {
get() {
const res = this[op_temp_key];
// 取值后马上移除引用关系
this[op_temp_key] = global.__op_temp_null_;
@Gaubee
Gaubee / H5lock.md
Last active March 1, 2018 02:57
Pattern Lock Base on Canvas

How to use

const lock = new H5lock({
  width: number,
  height: number,
  container: Element|id,
  chooseType ?: 2|3|4|5, // default is 3: 3×3
  inputEnd(pwd){
    console.log('Pattern Lock Value Is:', pwd);
 }