This file contains 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
# Parse input | |
def parse_input(s): | |
out = [] | |
for line in s.strip().split('\n'): | |
p,v = line.split(' @ ') | |
pp = [int(i) for i in p.split(',')] | |
vv = [int(i) for i in v.split(',')] | |
out.append((pp,vv)) | |
return out |
This file contains 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
// | |
// ConvertBlogFromPublishToJekyll.swift | |
// Quick and dirty script to translate the posts of my personal website from the | |
// [Publish](https://github.com/JohnSundell/Publish) site generator to the | |
// [Jekyll](https://jekyllrb.com/) site generator. | |
// | |
// Created by Jack Palevich on 12/27/20. | |
// | |
import Foundation |
This file contains 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
struct TVSlideshowView : View { | |
let publisher : AnyPublisher<UIImage?, Never> | |
@State private var uiImageA: UIImage? = nil | |
@State private var uiImageB: UIImage? = nil | |
@State private var imageAHasPriority: Bool = true | |
var body: some View { | |
ZStack { | |
decorate(uiImage: uiImageA, isImageA: true) |
This file contains 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
// Solve the anemone Botanicula puzzle. | |
// Number the anenome 1 to 7, left-to-right. | |
// Encode a list of anemones into a single integer, where bit 0 is anemone 1, etc. | |
func encode(_ d:[Int])->Int { | |
return d.reduce(0, {x, y in x | (1 << (y-1)) }) | |
} | |
// A list of which anemones are pulled down when a given anemone is tapped. | |
let moves = [ |