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
Shader "Custom/URPSimpleLit" | |
{ | |
Properties | |
{ | |
_Color ("Color", Color) = (1,0,0,1) | |
} | |
SubShader | |
{ | |
Tags { | |
"RenderPipeline" = "UniversalPipeline" |
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
public extension Optional { | |
/// Stop in the debugger in debug builds if self is `.none`. | |
/// | |
/// Example usage: | |
/// | |
/// guard let value = maybeValue.assertUnwrap() else { return "bogus value" } | |
/// | |
func assertUnwrap(_ message: @autoclosure () -> String? = nil, file: StaticString = #file, function: String = #function, line: UInt = #line) -> Wrapped? { | |
switch self { |
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
// Run any SwiftUI view as a Mac app. | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack { | |
Text("Hello, World") | |
.padding() | |
.background(Capsule().fill(Color.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
import Combine | |
// When wrapping a value, we take advantage of the setter | |
// to feed a PassthroughSubject | |
@propertyWrapper | |
struct Published<T> { | |
private var innerValue: T | |
private let innerSubject = PassthroughSubject<T, 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
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
var rootVC: UINavigationController? = nil | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
window = UIWindow(frame: UIScreen.main.bounds) |
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
extension CGPoint { | |
init(_ size: CGSize) { | |
self.x = size.width | |
self.y = size.height | |
} | |
init(_ vector: SCNVector3) { | |
self.x = CGFloat(vector.x) | |
self.y = CGFloat(vector.y) |
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
version: 0.1 | |
phases: | |
install: | |
commands: | |
- apt-get update | |
- apt-get install nodejs -y | |
- gem install bundler | |
- gem install middleman | |
pre_build: | |
commands: |
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
public static float Noise3D(float x, float y, float z, float frequency, float amplitude, float persistence, int octave, int seed) | |
{ | |
float noise = 0.0f; | |
for (int i = 0; i < octave; ++i) | |
{ | |
// Get all permutations of noise for each individual axis | |
float noiseXY = Mathf.PerlinNoise(x * frequency + seed, y * frequency + seed) * amplitude; | |
float noiseXZ = Mathf.PerlinNoise(x * frequency + seed, z * frequency + seed) * amplitude; | |
float noiseYZ = Mathf.PerlinNoise(y * frequency + seed, z * frequency + seed) * amplitude; |
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
// App | |
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app', | |
template: '<span>{{ sayHello() }}</span>', | |
}) | |
export class App { | |
public name: string = 'John'; |
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 UIKit | |
protocol NibLoadable: class { | |
typealias Object | |
static var nibName: String { get } | |
static var nib: UINib { get } | |
static var firstObjectFromNib: AnyObject? { get } | |
} | |
extension NibLoadable { |
NewerOlder