Skip to content

Instantly share code, notes, and snippets.

View jaywcjlove's full-sized avatar

小弟调调 jaywcjlove

View GitHub Profile
@unixzii
unixzii / WeatherView.swift
Created November 7, 2023 13:21
A demo of implementing iOS Weather card in SwiftUI.
import SwiftUI
struct HeaderView: View {
var body: some View {
HStack {
Image(systemName: "info.circle.fill")
.resizable()
.frame(width: 12, height: 12)
Text("Section Header")
.font(.system(size: 13))
@HashNuke
HashNuke / SwiftUI-SplitView-MacOS.swift
Last active January 5, 2024 18:53
Using a NSSplitViewController with SwiftUI on mac to render SwiftUI views as split panes. Drop this code into a playground to try it out. SORRY MAC-OS ONLY. DOES NOT WORK ON IOS
import AppKit
import SwiftUI
// Delete this line if not using a playground
import PlaygroundSupport
struct ContentView: View {
var body: some View {
// if spacing is not set to zero, there will be a gap after the first row
@unnamedd
unnamedd / MacEditorTextView.swift
Last active April 16, 2024 10:18
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@ptmt
ptmt / rn-cli.config.js
Last active March 8, 2020 16:21
rn-cli.config.js
const path = require('path');
// Don't forget to everything listed here to `package.json`
// modulePathIgnorePatterns.
const sharedBlacklist = [
/node_modules[/\\]react[/\\]dist[/\\].*/,
'downstream/core/invariant.js',
/website\/node_modules\/.*/,
@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@bag-man
bag-man / cpu.js
Last active May 5, 2024 22:16
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores