Skip to content

Instantly share code, notes, and snippets.

{
const ratioConfig = (x, y) => ({
x,
y,
ratio: x / y
})
const commonRatio = [ratioConfig(1, 1), ratioConfig(4, 3), ratioConfig(16, 9), ratioConfig(16, 10)];
const getRatioConfig = (x, y) => {
@fhefh2015
fhefh2015 / gitea.md
Last active March 11, 2021 03:50
Gitea搭建

MySQL

# 以root用户登录数据库
mysql -u root -p
Enter password:

# 如果你的gitea和mysql是在同一台服务器上,按照下面的创建
mysql> CREATE USER 'gitea' IDENTIFIED BY '密码';

# 对于不在一台服务器上的,则可以按照下面的语句进行创建
@fhefh2015
fhefh2015 / iOS Shortcut Download JavaScript.txt
Created February 16, 2021 13:39 — forked from ohmika/iOS Shortcut Download JavaScript.txt
Use the bookmarklet or JavaScript in order to download the shortcut file from an icloud.com link
javascript:%22use%20strict%22;%0Alet%20iCloudUrl%20%3D%20location.href;%0Alet%20apiUrl%20%3D%20iCloudUrl.replace(/%5C/shortcuts/g,%20%22/shortcuts/api/records%22);%0Alet%20iCloudApi%20%3D%20new%20XMLHttpRequest();%0AiCloudApi.open(%22GET%22,%20apiUrl);%0AiCloudApi.responseType%20%3D%20%22text%22;%0AiCloudApi.send();%0A%0AiCloudApi.onload%20%3D%20function()%20%7B%0A%20%20let%20apiResult%20%3D%20JSON.parse(iCloudApi.response);%0A%0A%20%20function%20saveData(url)%20%7B%0A%20%20%20%20let%20a%20%3D%20document.createElement(%22a%22);%0A%20%20%20%20document.body.appendChild(a);%0A%20%20%20%20a.style%20%3D%20%22display:%20none%22;%0A%0A%20%20%20%20a.href%20%3D%20url;%0A%20%20%20%20a.download;%0A%20%20%20%20a.click();%0A%20%20%20%20window.URL.revokeObjectURL(url);%0A%20%20%7D%0A%20%20let%20downloadURL%20%3D%20apiResult.fields.shortcut.value.downloadURL;%0A%20%20let%20shortcutName%20%3D%20apiResult.fields.name.value;%0A%20%20let%20finalURL%20%3D%20downloadURL.replace(%22$%7Bf%7D%22,%20shortcutName%20+%20%22.shortcut%22
@fhefh2015
fhefh2015 / ._reactFormatting
Created February 15, 2021 11:19 — forked from iannbing/._reactFormatting
A gist for initial eslint and prettier setup for React projects
We couldn’t find that file to show.
https://techviewleo.com/install-parallels-tools-in-kali-linux-virtual-machine/
@fhefh2015
fhefh2015 / color.swift
Created February 2, 2021 07:20
UIColor(hex: "#f6f6f6")
extension UIColor {
public convenience init(hex: String) {
var r: CGFloat = 0
var g: CGFloat = 0
var b: CGFloat = 0
var a: CGFloat = 1
let hexColor = hex.replacingOccurrences(of: "#", with: "")
let scanner = Scanner(string: hexColor)
var hexNumber: UInt64 = 0
@fhefh2015
fhefh2015 / README.md
Created December 8, 2020 14:27 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@fhefh2015
fhefh2015 / check_mobile.js
Last active October 10, 2020 12:47
2020最新移动 联通 电信号码正则
//https://juejin.im/post/6844904109800161294
//2020最新移动,联通,电信号码正则
//由于新增了197、199、190等新号段,最新移动,电信,联通号段如下: 移动号段: 134、135、136、137、138、139、147、150、151、152、157、158、159、172、178、182、183、184、187、188、195 、198、197
//联通号段: 130、131、132、145、146、155、156、166、170、171、175、176、185、186、196
//电信号段: 133、141、149、153、173、174、177、179、180、181、189、191、193、199、190
//手机号码验证(号码验证没有特别严谨):
function isMobile(s) {
let reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; //验证规则
let flag = reg.test(s); //true
@fhefh2015
fhefh2015 / screen.js
Created October 10, 2020 12:23
获取屏幕宽度高度
function get_screen_size() {
return {
width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
};
}
@fhefh2015
fhefh2015 / launch.json
Last active March 26, 2024 08:00
Nest.js VSCode Chrome Debug
//.vscode/launch.json
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{