This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 动态弹出视图方法 | |
* | |
* ```ts | |
* const { show, close } = usePopup(); | |
show( | |
<button | |
onClick={async () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tcpPortIsCanUse(port: in_port_t) -> Bool { | |
let socketFileDescriptor = socket(AF_INET, SOCK_STREAM, 0) | |
if socketFileDescriptor == -1 { | |
return false | |
} | |
defer { | |
Darwin.shutdown(socketFileDescriptor, SHUT_RDWR) | |
close(socketFileDescriptor) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
OpenInstall = function (e, n, t) { | |
function r(n) { | |
n = n || e.location.href;for (var t = n.indexOf("?"), r = -1 == t ? "" : n.substring(t + 1).replace(/\+/g, "%20"), i = r.split("&"), o = {}, a = 0; a < i.length; a++) { | |
var c = i[a].split("="), | |
u = decodeURIComponent(c[0] || ""), | |
l = decodeURIComponent(c[1] || "");u && l && (void 0 === o[u] ? o[u] = l : "object" == _typeof(o[u]) ? o[u].push(l) : o[u] = [o[u], l]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
createApp, | |
defineComponent, | |
onMounted, | |
PropType, | |
ref, | |
Transition | |
} from "vue"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Query for the toggle that is used to change between themes | |
const toggle = document.querySelector('#themeToggle'); | |
// Listen for the toggle check/uncheck to toggle the dark class on the <body> | |
toggle.addEventListener('ionChange', (ev) => { | |
document.body.classList.toggle('dark', ev.detail.checked); | |
}); | |
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
use: | |
```js | |
import router from "<you router path>" | |
import KeepScroll from "<you code path>" | |
Vue.use(KeepScroll, { router }) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// String+Country.swift | |
// Rate | |
// | |
// Created by 0x30 on 2017/11/20. | |
// Copyright © 2017年 s. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// String+Regex.swift | |
// Rate | |
// | |
// Created by 荆文征 on 2017/11/20. | |
// Copyright © 2017年 s. All rights reserved. | |
// | |
import Regex | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)setTopBackgroundColor:(UIColor *)color{ | |
CGRect frame = self.bounds; | |
frame.origin.y = -CGRectGetHeight(UIScreen.mainScreen.bounds); | |
frame.size = UIScreen.mainScreen.bounds.size; | |
UIView* grayView = [UIView.alloc initWithFrame:frame]; | |
grayView.backgroundColor = color; | |
[self addSubview:grayView]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (UIColor *)colorFromHexString:(NSString *)hexString { | |
unsigned rgbValue = 0; | |
NSScanner *scanner = [NSScanner scannerWithString:hexString]; | |
[scanner setScanLocation:1]; // bypass '#' character | |
[scanner scanHexInt:&rgbValue]; | |
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0]; | |
} |
NewerOlder