Skip to content

Instantly share code, notes, and snippets.

View StefKors's full-sized avatar
📟

Stef Kors StefKors

📟
View GitHub Profile
@StefKors
StefKors / ContentView.swift
Created April 4, 2024 20:46
ScrollView + Sheet
//
// ContentView.swift
// 324 Messenger
//
// Created by Stef Kors on 29/03/2024.
//
import SwiftUI
import SwiftData
@StefKors
StefKors / onKeyPress.swift
Last active March 29, 2024 13:01
SwiftUI keyboard events based on keyawareview and keyboardshortcuts
//
// KeyAwareView.swift
//
// Created by Stef Kors on 04/09/2023.
//
// source: https://onmyway133.com/posts/how-to-handle-keydown-in-swiftui-for-macos/
// source: https://github.com/sindresorhus/KeyboardShortcuts/blob/main/Sources/KeyboardShortcuts/Key.swift
import SwiftUI
import Carbon.HIToolbox
@StefKors
StefKors / FocusBlockingOnKeyPress keyboardshortcuts.swift
Last active September 4, 2023 08:51
OnKeyPress needs focus, which makes it totally useless for global keyboard actions
//
// ContentView.swift
// OnKeyPressIssue
//
// Created by Stef Kors on 04/09/2023.
//
import SwiftUI
struct ChildView: View {
@StefKors
StefKors / LazyContentWindow.swift
Created March 16, 2023 12:36
Example of SwiftUI Data loading with LazyVStack and ScrollViews. First you create an array with some identifier of your long list. Then in the child view you use `.task { }` to load the data based of the ID. The LazyVStack will take care of loading the next view.
//
// LazyContentWindow.swift
// Commitment
//
// Created by Stef Kors on 16/03/2023.
//
import SwiftUI
struct LazyLoadedView: View {
export type BaseCountry = {
// the ISO 3166-1 code for the country
code: string
// the name of the country (in english)
name: string
// the raw emoji for the country's flag (can be multiple codepoints)
emoji: string
// the international dialing code for the country (without the `+` prefix or escape codes)
dial_country_code: string
// the regions codes, if any
@StefKors
StefKors / Emoji.swift
Created December 15, 2022 11:15
Array of Emoji manually filtered to contain only all the fun and positive ones
let array = ["😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "🥲", "🥹", "😊", "😇", "🙂", "🙃", "😉", "😌", "😍", "🥰", "😘", "😗", "😙", "😚", "😋", "😛", "😝", "😜", "🤪", "🤨", "🧐", "🤓", "😎", "🥸", "🤩", "🥳", "😏", "😒", "😞", "😔", "😟", "😕", "🙁", "☹️", "😣", "😖", "😫", "😩", "🥺", "😢", "😭", "🤯", "🥶", "😱", "😨", "😰", "😥", "😓", "🫣", "🤗", "🫡", "🤔", "🫢", "🤭", "🤫", "🤥", "😶", "😶‍🌫️", "😐", "😑", "😬", "🫠", "🙄", "😯", "😮", "😲", "🥱", "😴", "🤤", "😪", "😵", "😵‍💫", "🫥", "🤐", "🥴", "🤢", "🤑", "🤠", "🤡", "💩", "👻", "👽", "👾", "🤖", "🎃", "😺", "😸", "😹", "😻", "😼", "😽", "🙀", "👋", "🤚", "🖐", "✋", "🖖", "👌", "🤌", "🤏", "✌️", "🤞", "🫰", "🤟", "🤘", "🤙", "🫵", "🫱", "🫲", "🫳", "🫴", "👈", "👉", "👆", "🖕", "👇", "☝️", "👍", "👎", "✊", "👊", "🤛", "🤜", "👏", "🫶", "🙌", "👐", "🤲", "🤝", "🙏", "✍️", "💅", "🤳", "💪", "🦾", "🦵", "🦿", "🦶", "👣", "👂", "🦻", "👃", "🫀", "🫁", "🧠", "🦷", "🦴", "👀", "👁", "👶", "👧", "🧒", "👦", "👩", "🧑", "👨", "👩‍🦱", "🧑‍🦱", "👨‍🦱", "👩‍🦰", "🧑‍🦰", "👨‍🦰", "👱‍♀️", "👱", "👱‍♂️", "👩‍🦳", "🧑‍🦳", "👨‍🦳", "👩‍🦲", "🧑‍🦲", "👨‍🦲", "🧔‍♀️", "🧔", "🧔‍♂️", "👵", "🧓", "👴", "👲", "👳‍♀️", "👳", "👳‍♂️", "🧕", "👮‍♀️", "👮
@StefKors
StefKors / DraggableView.swift
Created July 31, 2021 14:58 — forked from ohayon/DraggableView.swift
Example of making a reusable `draggable()` modifier for SwiftUI Views
struct DraggablePita: View {
var body: some View {
Image(uiImage: UIImage(named: "pita.png")!)
.draggable() // Add the new, custom modifier to make this draggable
}
}
// Handle dragging
struct DraggableView: ViewModifier {
@State var offset = CGPoint(x: 0, y: 0)
_ _ _ _
| | | | ___ | || | ___
| |_| | / _ \| || | / _ \
| _ || __/| || || (_) |
|_| |_| \___||_||_| \___/

install the following

xcode-select --install

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install git

git config --global user.name "Your Name Here"
const router = require('express').Router()
// FLICKR
const FLICKR_API = require('../../settings/flickr.js')
const Flickr = require('flickr-sdk')
const flickr = new Flickr(FLICKR_API.key)
// FIREBASE
const admin = require('firebase-admin')
const serviceAccount = require('./../../settings/progressbar-cache-firebase-adminsdk.json')
// init firebase app