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
@available(iOS 16.0, *) | |
struct SpacingDemo_Previews: PreviewProvider { | |
static var previews: some View { | |
NavigationStack { | |
Form { | |
Group { | |
Section { | |
HStack { | |
Spacer() | |
Rectangle().fill(.blue) |
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
/* Example Usage | |
struct ContentView: View { | |
let isRounded: Bool | |
var body: some View { | |
Color.blue | |
.conditionalModifier { view in | |
if isRounded { | |
view.clipShape(Circle()) |
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 SwiftUI | |
@propertyWrapper public struct DataStorage<Value: Codable>: DynamicProperty { | |
// MARK: - Private Properties | |
private var defaultValue: Value | |
private var storageKey: String | |
private var store: UserDefaults | |
private var data: AppStorage<Data?> |
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
type AnyArray = any[]; | |
type AnyArrayWithItems = [any, ...any]; | |
type AnyFunction<Arguments extends any[] = any[]> = (...args: Arguments) => any; | |
// The type of the first item in an array. | |
// Input: `[1, 2, 3]` | |
// Output: `1` | |
type Head<SomeArray extends AnyArray> = SomeArray extends AnyArrayWithItems | |
? SomeArray[0] | |
: never; |
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
/* | |
* This script will automatically play a sound and trigger an alert when it finds available appointments | |
* on the New York State vaccine finder website. https://am-i-eligible.covid19vaccine.health.ny.gov/Public/providers | |
* It can be run by pasting it into the Chrome console at the above URL. | |
* | |
* NOTE: You must meet certain eligibility criteria to qualify for a vaccine. | |
*/ | |
// Map of all providers - use to populate `providersToCheck` field. | |
const Providers = { |
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
// I ran this with: | |
// while true; do node ~/Desktop/google.js --max_old_space_size=4096 --optimize_for_size --max_executable_size=4096 --stack_size=4096 && break; done | |
// This will run the script with 4GB allocated memory, and auto-restart if it crashes (happens sometimes due to out of memory). | |
const https = require('https'); | |
const fs = require('fs'); | |
// File storage between runs. | |
const validStorage = '/Users/ruben/Desktop/validURLs.txt'; | |
const attemptsStorage = '/Users/ruben/Desktop/attempts.txt'; |
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
#Begin GoogleSearch CLI for Mac | |
function google() { | |
if [ $1 = "--images" ]; then | |
open https://google.com/search?tbm=isch\&q="$2" | |
elif [ $1 = "--news" ]; then | |
open https://google.com/search?tbm=nws\&q="$2" | |
else | |
open https://google.com/search?q="$1" | |
fi | |
} |
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
class console { | |
class func log(arg : Any) { | |
print(arg) | |
} | |
} | |
console.log("Hello World!") |