This file contains hidden or 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
//: [Previous](@previous) | |
import SwiftUI | |
import PlaygroundSupport | |
struct SliderView: View { | |
@State private var containerWidth: CGFloat = 0 | |
private var leadingOffset: CGFloat { | |
(containerWidth - (containerWidth * normalScale)) / 2 | |
} |
This file contains hidden or 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 | |
@propertyWrapper | |
struct UIColorHexString: Codable { | |
private var stringValue: String | |
var wrappedValue: UIColor { | |
get { UIColor(hexString: stringValue) } | |
set { stringValue = newValue.hexString } | |
} |
This file contains hidden or 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 | |
@propertyWrapper | |
struct CodableEnum<T: RawRepresentable>: Codable where T.RawValue: Codable { | |
private var value: T.RawValue | |
var wrappedValue: T { | |
get { T(rawValue: value)! } | |
set { value = newValue.rawValue } | |
} | |
This file contains hidden or 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
for epoch in range(num_epochs): | |
for n, (real_samples, _) in enumerate(train_loader): | |
# Обучение дискриминатора | |
optimizer_discriminator.zero_grad() | |
# Данные для тренировки дискриминатора | |
real_samples = real_samples.to(device=device) | |
real_samples_labels = torch.ones((batch_size, 1)).to(device=device) | |
real_outp = discriminator(real_samples) |
This file contains hidden or 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
#Created by: Adobe Photoshop Export Color Lookup Plugin | |
#Copyright: (C) Copyright 2017 RocketStock | |
TITLE "Sepia" | |
#LUT size | |
LUT_3D_SIZE 32 | |
#data domain | |
DOMAIN_MIN 0.0 0.0 0.0 | |
DOMAIN_MAX 1.0 1.0 1.0 |
This file contains hidden or 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
uniform vec3 uLine; | |
uniform vec4 uLiquidColor; | |
uniform float uLineHeight; | |
uniform float uFrenelPow; | |
in Vert { | |
vec3 objectPoint; | |
vec3 normalForCam; | |
} iVert; |
This file contains hidden or 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 Vertex Shader | |
out v2f { | |
flat int cameraIndex; | |
vec3 p; | |
vec4 pos; | |
vec2 uv; | |
mat3 tbn; | |
} oVert; |
This file contains hidden or 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
uniform float uTime; | |
uniform sampler2D frontTex; | |
in v2f { | |
flat int cameraIndex; | |
vec4 pos; | |
vec3 originalP; | |
vec2 uv; | |
mat3 tbn; |
This file contains hidden or 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
uniform vec3 heights; | |
uniform sampler2D texLayerOne; | |
uniform sampler2D texLayerTwo; | |
uniform sampler2D texLayerThree; | |
uniform sampler2D frontTex; | |
in v2f { | |
flat int cameraIndex; | |
vec4 pos; |
This file contains hidden or 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 randomString(length: Int) -> String { | |
return (0..<length).map { _ in String(Int.random(in: 0...9)) }.joined() | |
} | |
func randomStringBuffer(length: Int) -> String { | |
var buffer = "" | |
(0..<length).forEach { _ in buffer += String(Int.random(in: 0...9)) } | |
return buffer | |
} |
NewerOlder