Skip to content

Instantly share code, notes, and snippets.

View dymx101's full-sized avatar
🎯
Focusing

Yiming Dong dymx101

🎯
Focusing
View GitHub Profile
@dymx101
dymx101 / gist:167833b04d676b83529f9964d0dd2cf6
Created February 20, 2023 02:34
如何用NodeJS写ChatGPT API?
### 初始化工程
```
npm init
```
### 安装依赖
```
npm install express
```
### 环境变量
1. 在工程根目录创建 `.env`文件
@dymx101
dymx101 / gist:3b65e984be709e8aef43d1cea73ac913
Created February 16, 2023 06:14
Use Xcode 13.1 on macOS Ventura
Step 1: sudo xcode-select -s /Applications/Xcode-13.1.0.app
Step 2: open /Applications/Xcode-13.1.0.app/Contents/MacOS/Xcode
Extra Step (If step 2 not working, run the script below, then do step 2 again).
```
#!/bin/bash
set -eux
readonly xcode13="/Applications/Xcode-13.1.0.app"
readonly xcode14="/Applications/Xcode-14.1.0.app"
grab://open?&screenType=BOOKING&vertical=Car&taxiTypeId=302&pickUpLatitude=1.4116&pickUpLongitude=103.6723&pickUpAddress=Murai&dropOffLatitude=1.279064695&dropOffLongitude=103.8428995&dropOffAddress=39%20Duxton%20Hill&dropOffKeywords=THE%20COACH%27S%20BAGEL%20SHOP&pickUpTime=2023-01-11%2023%3A00%3A00
@dymx101
dymx101 / gist:74288b58145d741e287c6c0252470e8c
Created April 15, 2022 01:33
How values are captured in clousure
So values copied when captured using a capture list, while they’re not copied when referenced directly — for example when accessed as properties, or when a local variable is captured within the same scope as it was defined in.
public func createView<T>(_ setup: ((T) -> Void)) -> T where T: UIView {
let view = T()
view.translatesAutoresizingMaskIntoConstraints = false
setup(view)
return view
}
@dymx101
dymx101 / main.dart
Last active March 15, 2021 12:30
flutter_overlapped_list_header
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@dymx101
dymx101 / gist:37f2dc0ffdb299dc999da195fde6de4a
Created March 4, 2021 12:19
appEnhancer blocked my acc
because you said i have too many warnings? okay, i did gave every app a decent review, i am not a cheater. or the real reason is that i cancelled my subscription? i have to say it suck, i can not even get an average of 3 reviews per day, far from the reviews which you boast that i can get from the plan, so who is cheating?
@dymx101
dymx101 / gist:fb684c14a741e02ad37d97f8a11ae605
Created November 23, 2020 05:56
How to check why Charles Proxy not working
1. if the ssl cert has been downloaded and verified in settings->general->about->certificate trust settings
2. if charles proxy configuration profile has been installed and verified in settings->general->Profile
3. if SSL proxy settings has enabled your domains.
https://xcodebuildsettings.com/
@dymx101
dymx101 / ShadowContainer.swift
Created April 2, 2020 08:26
A container view helps drop shadow
class ShadowContainer: UIView {
init(child: UIView,
shadowRadius: CGFloat = 2,
shadowOffset: CGSize = CGSize.zero,
shadowOpacity: Float = 0.3) {
super.init(frame: CGRect.zero)
translatesAutoresizingMaskIntoConstraints = false
addSubview(child)
child.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true