Skip to content

Instantly share code, notes, and snippets.

View tyirvine's full-sized avatar
🍄
Probably listening to music ...

Ty Irvine tyirvine

🍄
Probably listening to music ...
View GitHub Profile
@tyirvine
tyirvine / .gitignore
Created November 4, 2021 07:01
.gitignore for Unity
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@tyirvine
tyirvine / InactiveWindowTapHelper.swift
Created June 14, 2021 21:02
This registers clicks on a view in SwiftUI even when the window is not key or main
//
// InactiveWindowTapHelper.swift
//
// Created by Ty Irvine on 2021-06-14.
//
// This registers clicks on a view in SwiftUI even when the window is not key or main.
//
// Usage ⤵︎
/*
@tyirvine
tyirvine / main.yml
Last active January 27, 2021 06:41 — forked from shiena/main.yml
dotnet-format for github actions (on push) - C#
# This workflow ensures all code being pushed to your repo. is formatted
name: Auto-Format
# Controls when the action will run.
on:
push:
branches:
- "**"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
@tyirvine
tyirvine / shorthand-example.swift
Created October 29, 2020 20:14
Swift Shorthand Example
Button(action: self.textField.value?.becomeFirstResponder()) {
Text("Bonk")
}
@tyirvine
tyirvine / grid-demonstration.swift
Created October 27, 2020 23:38
grid-demonstration
// We can make the square's size a constant and use that
let squareSize: CGFloat = 10
// Our square
struct Square: View {
var color: Color
var body: some View {
RoundedRectangle(cornerRadius: 0)
.frame(width: squareSize, height: squareSize, alignment: .center)
@tyirvine
tyirvine / grid-constants.txt
Created October 27, 2020 21:44
SwiftUIGrids-constants
let vSpacing: CGFloat = 9
let hSpacing: CGFloat = vSpacing - 6
@tyirvine
tyirvine / foreach-copycat.swift
Created October 25, 2020 23:29
Example of what not to do in SwiftUI
import SwiftUI
// Main View
struct ContentView: View {
var body: some View {
VStack(alignment: /*@START_MENU_TOKEN@*/ .center/*@END_MENU_TOKEN@*/, spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: {
Text("I love Turtles")
Text("I love Turtles")
Text("I love Turtles")
Text("I love Turtles")
@tyirvine
tyirvine / foreach.swift
Created October 25, 2020 23:25
For Each loops for SwiftUI!
import SwiftUI
// Main View
struct ContentView: View {
var body: some View {
VStack(alignment: /*@START_MENU_TOKEN@*/ .center/*@END_MENU_TOKEN@*/, spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: {
ForEach(1 ..< 10) { _ in
Text("I love Turtles")
}
})
@tyirvine
tyirvine / setactorsworldrotation.txt
Last active October 13, 2020 22:39
Set Actor's World Rotation #Unreal
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_16"
bIsPureFunc=True
FunctionReference=(MemberParent=Class'"/Script/Engine.KismetMathLibrary"',MemberName="MakeRotator")
NodePosX=3387
NodePosY=281
NodeGuid=FF31EC544FA646A1F2F023BA4CA8E5AE
CustomProperties Pin (PinId=62A2E6FB42479AE61E42D1B8663B688E,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet Math Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.KismetMathLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,DefaultObject="/Script/Engine.Default__KismetMathLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
@tyirvine
tyirvine / multiplayerspawnset.txt
Created October 9, 2020 22:42
Multiplayer Spawn Set #Unreal
Begin Object Class=/Script/BlueprintGraph.K2Node_FunctionEntry Name="K2Node_FunctionEntry_0"
FunctionReference=(MemberParent=Class'"/Script/Engine.GameModeBase"',MemberName="ChoosePlayerStart")
NodeGuid=FAE7542647B2F5ABB604DC84089E1C78
CustomProperties Pin (PinId=960B51AA40806E1A803BA88DB8B26F24,PinName="then",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(K2Node_CallFunction_0 F77840A84513B72B85E3B8BF6C446997,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=59398350462090DF959FC5B95AF6569B,PinName="Player",PinToolTip="Player\nController Object Reference\n\nis the controller for whom we are choo