Skip to content

Instantly share code, notes, and snippets.

View kicsipixel's full-sized avatar
🚜
Working hard...

Szabolcs Toth kicsipixel

🚜
Working hard...
View GitHub Profile
@kicsipixel
kicsipixel / fly.toml
Last active March 13, 2024 22:13
Fly
# fly.toml app configuration file generated for part2 on 2024-02-24T19:58:21+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'part2'
primary_region = 'ams'
[build]
@kicsipixel
kicsipixel / Dockerfile
Last active February 23, 2024 16:15
Docker
FROM swift:latest
COPY Hello.swift /usr/src/app/
WORKDIR /usr/src/app/
RUN [ "swiftc", "Hello.swift", "-o", "Hello" ]
ENTRYPOINT ["./Hello"]
@kicsipixel
kicsipixel / Brazil.json
Last active June 17, 2024 10:03
Outdoor gym files part 2
{
"name": "Outdoor Gym",
"coordinates": {
"latitude": -22.988889,
"longitude": 43.190556
},
"city": "Rio de Janiero",
"country": "Brazil"
}
struct AddCityAndCountryToGymTableMigration: AsyncMigration {
func prepare(on database: FluentKit.Database) async throws {
try await database.schema("gyms")
.field("city", .string)
.field("country", .string)
.update()
}
func revert(on database: FluentKit.Database) async throws {
try await database.schema("gyms")
@kicsipixel
kicsipixel / AppDelegate.swift
Last active June 4, 2020 21:21
SemiStoryboard
class AppDelegate: NSObject, NSApplicationDelegate {
lazy var mainWindowController = MainWindowController()
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
mainWindowController.showWindow(nil)
}
func applicationWillTerminate(_ aNotification: Notification) {
@objc dynamic var peopleArray: [Person] = [Person(firstName: "Ragnar", lastName: "Lothbrok", mobileNumber: "555-1234"),
Person(firstName: "Bjorn", lastName: "Lothbrok", mobileNumber: "555-3412"),
Person(firstName: "Harald", lastName: "Finehair", mobileNumber: "555-4512")
]
@kicsipixel
kicsipixel / Person.swift
Last active April 30, 2020 10:33
Cocoa Bindings
import Foundation
class Person: NSObject {
@objc dynamic var firstName: String
@objc dynamic var lastName: String
@objc dynamic var mobileNumber: String
init(firstName: String, lastName: String, mobileNumber: String) {
self.firstName = firstName
self.lastName = lastName
private var window: NSWindow?
func applicationDidFinishLaunching(_ aNotification: Notification) {
let windowSize = NSSize(width: 480, height: 240)
let screenSize = NSScreen.main?.frame.size ?? .zero
let rect = NSMakeRect(screenSize.width/2 - windowSize.width/2, screenSize.height/2 - windowSize.height/2, windowSize.width, windowSize.height)
window = NSWindow(contentRect: rect, styleMask: [.miniaturizable, .closable, .resizable, .titled], backing: .buffered, defer: false)
window?.title = "No Storyboard Window"
window?.makeKeyAndOrderFront(nil)
@kicsipixel
kicsipixel / ViewController.swift
Created November 14, 2018 10:42
ViewController with NSAppearance KVO
import Cocoa
class ViewController: NSViewController {
private var appearanceChangeObservation: NSKeyValueObservation?
@IBOutlet var imageView: NSImageView!
override func viewDidLoad() {
super.viewDidLoad()
@kicsipixel
kicsipixel / CustomWindowToolbar.swift
Created November 14, 2018 10:17
Custom Window with Toolbar image
import Cocoa
class CustomWindow: NSWindowController {
@IBOutlet var modeIndicator: NSToolbarItem!
var windowColor = NSColor(named: "WindowColor") {
didSet {
configureWindowAppearance()
}