Skip to content

Instantly share code, notes, and snippets.

View gee1k's full-sized avatar
:shipit:
Focusing

Svend gee1k

:shipit:
Focusing
View GitHub Profile
@gee1k
gee1k / Utils.swift
Created March 19, 2023 14:06
iOS14 Local Network
import Foundation
import Network
public class Utils {
static func requestLocalNetworkAuthorization(_ timeout: Int = 1, completion: @escaping (_ granted: Bool) -> Void) {
let ipv4 = getIPv4Address() ?? "127.0.0.1"
var ipArr = ipv4.split(separator: ".")
ipArr[ipArr.count - 1] = "1"
let routerIp = ipArr.joined(separator: ".")
@gee1k
gee1k / .eslintrc.js
Created March 28, 2022 06:50
React Typescript ESLint Prettier
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
@gee1k
gee1k / 修复 MediaRecorder 录制的视频时长.js
Last active August 12, 2021 02:07
纯JS录制Video标签播放的视频
import { Decoder, tools, Reader } from './EBML.js'
// EBML: https://www.webrtc-experiment.com/EBML.js
/**
* @param {Blob} file - File or Blob object.
* @param {function} callback - Callback function.
* @example
* getSeekableBlob(blob or file, callback);
var objectsToExclude = [point];
viewer.scene.postRender.addEventListener(function () {
var position = point.position.getValue(viewer.clock.currentTime);
point.position = viewer.scene.clampToHeight(position, objectsToExclude);
});
//
// DiskPermissionManager.swift
// uPic
//
// Created by Svend Jin on 2021/01/19.
// Copyright © 2021 Svend Jin. All rights reserved.
//
// entitlements 文件加入
// <key>com.apple.security.files.user-selected.read-only</key>
function distance(latlng1, latlng2) {
var rad = Math.PI / 180,
lat1 = latlng1.lat * rad,
lat2 = latlng2.lat * rad,
a = Math.sin(lat1) * Math.sin(lat2) +
Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlng2.lng - latlng1.lng) * rad);
// 地球半径
return 6371000 * Math.acos(Math.min(a, 1));
}
function ConvertToD(rawData) {
var du = "0";
if (rawData.indexOf("°") != -1) {
du = rawData.substring(0, rawData.indexOf("°"));
}
var fen = "0";
if (rawData.indexOf("′") != -1) {
var fen = rawData.substring(rawData.indexOf("°") + 1, rawData.indexOf("′"));
}
var miao = "0";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.bg {
position: absolute;
top: 0;
left: 0;
@gee1k
gee1k / gitstars.json
Created February 8, 2018 09:06
github stars manager for production
{"tags":[],"lastModified":1518080816555}