Skip to content

Instantly share code, notes, and snippets.

View karlis's full-sized avatar

Karlis Lukstins karlis

View GitHub Profile
@karlis
karlis / gitconfig
Last active April 6, 2021 12:51
gitconfig
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[user]
name = Karlis Lukstins
email = karlis@lukstins.com
[alias]
b = !git branch
@karlis
karlis / RotationGesture.swift
Created February 16, 2021 13:58
Work in progress. Example SwiftUI gesture. One finger rotation around center.
//
// Example.swift
// Vinyl
//
// Created by Karlis Lukstins on 16/02/2021.
//
import SwiftUI
// MARK: - Example
@karlis
karlis / d21.swift
Last active December 21, 2020 18:59
struct Food {
let ingredient: Set<String>
let allergens: Set<String>
}
func parse(_ input: String) -> [Food] {
return input
.components(separatedBy: .newlines)
.map {
let parts = $0.components(separatedBy: " (contains ")
// 64802175715999
public let d20 = """
Tile 2897:
####..##..
.........#
..........
.#........
##......##
.......#..
...#...##.
@karlis
karlis / day10.swift
Created December 10, 2020 14:15
Advent2020Day10
public struct Day10 {
var adapterTypes: [Bool]
public init(input: String) {
var parsed = Self.parse(input)
parsed.append(0)
adapterTypes = parsed
.sorted()
.slidingWindows(ofCount: 2) // import swift-algorithms
@karlis
karlis / ReusableCell.swift
Created October 19, 2019 12:29
ReusableCell for easy dequeueing in UITableView.
/// ReusableCell for easy dequeueing in table views. Use UITableView.dequeueReusableCell().
protocol ReusableCell {
static var reuseIdentifier: String { get }
init()
}
extension UITableView {
/// Dequeues a ReusableCell or allocates a new ReusableCell.
func dequeueReusableCell<Cell: ReusableCell>() -> Cell {
return dequeueReusableCell(withIdentifier: Cell.reuseIdentifier) as? Cell ?? Cell()

Keybase proof

I hereby claim:

  • I am karlis on github.
  • I am karlis (https://keybase.io/karlis) on keybase.
  • I have a public key ASBO5VK6vHUTvTaw6gyt5A2YdfI_A24cYq_nWf7M1LUBNQo

To claim this, I am signing this object:

@karlis
karlis / keybase.md
Created May 15, 2014 08:23
Keybase proof

Keybase proof

I hereby claim:

  • I am karlis on github.
  • I am karlis (https://keybase.io/karlis) on keybase.
  • I have a public key whose fingerprint is 39C5 35D6 BD6F 6DDE BDCE E93B E048 1EB5 BCA5 46CD

To claim this, I am signing this object: