Skip to content

Instantly share code, notes, and snippets.

View JanC's full-sized avatar

Jan Chaloupecky JanC

  • N26
  • Berlin
View GitHub Profile
// Version 1: Using initializer directly
struct ContentView: View {
@State var count = 0
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
var body: some View {
VStack {
Text("container: \(count)")
.padding()
@dbarden
dbarden / json.py
Last active November 21, 2020 06:34
json chisel command
#!/usr/bin/python
# Example file with custom commands, located at /magical/commands/example.py
import lldb
import fbchisellldbbase as fb
def lldbcommands():
return [ JSON() ]
class JSON(fb.FBCommand):
@NSExceptional
NSExceptional / AutoLayout.md
Last active December 8, 2021 06:19
The best damn AutoLayout guide I've ever seen

Edit Feb 4 5:16 PM: Skip to the bottom if you just want the article

It has been brought to my attention that rehosting someone else's content without asking them — even if you link to the original content — is not exactly polite. I did not ask the author before I rehosted his article, and while I feel I should have known better than to that, it just didn't occurr to me. It's not exactly plagarism, but it's still wrong on some level. I have reached out to him now about hosting it here publically, and if he says it's alright, I'll put it back.

You can find the original article here, on his site, and on his Medium page.

lsof -i :19421 #find out which PID zoom server is on
lsof -i :19424 #if you are running Ring Central for Meetings (rebranded zoom) check this port out
lsof -i :19433 #if you are running Chinese version of Zoom (Zhumu) check this port out
kill -9 PID #kill the server - insert PID number you will find
rm -rf ~/.zoomus/ #remove zoom server from your Mac
rm -rf /Applications/zoom.us.app/Contents/Frameworks/ZoomOpener.app/ #remove zoom server from the zoom app bundle
@fnordomat
fnordomat / CDWiFi (České dráhy) WiFi Internet Access
Last active November 7, 2023 16:58
Automatic negotiation of a captive portal: connect to icomera wifi in CD trains without having to jump through hoops.
# I believe this is the necessary and sufficient step to get internet access on board the Czech long distance trains (e.g. EuroCity which runs from Prague to Kiel)
curl -vLA '' 'http://cdwifi.cz/portal/api/vehicle/gateway/user/authenticate'
# It says "500 internal server error" but that doesn't keep it from working.
# check with this request, answer should contain "authenticated":1
curl -vLA '' 'http://cdwifi.cz/portal/api/vehicle/gateway/user'
# Also nice: GPS data (but seems outdated)
curl -vLA '' 'http://cdwifi.cz/portal/internal/api/x6/position'
@namannik
namannik / MGLMapView+MBTiles.swift
Last active April 10, 2024 16:28
MGLMapView+MBTiles
import Foundation
import Mapbox
import SQLite
// MARK: MbtilesSource
enum MBTilesSourceError: Error {
case CouldNotReadFileError
case UnknownFormatError
case UnsupportedFormatError
@samwize
samwize / DynamicKey.swift
Created September 28, 2017 06:59
A CodingKey that is dynamic -- it can be any string! Encode/decode with a Dictionary of `[String : Any]` in the model.
/**
```
// Encode a model with properties of type [String : Any]
var propertiesContainer = container.nestedContainer(keyedBy: DynamicKey.self, forKey: .properties)
if let properties = properties {
try propertiesContainer.encodeDynamicKeyValues(withDictionary: properties)
}
```
*/
struct DynamicKey: CodingKey {
@satoshin2071
satoshin2071 / PatternMatchingPart4.swift
Created May 24, 2016 08:37
Swift Pattern Matching, Part 4: if case, guard case, for case. Shakyo practice.
/*
From http://alisoftware.github.io/swift/pattern-matching/2016/05/16/pattern-matching-4/
Shakyo practice
Pattern Matching, Part 4: if case, guard case, for case
*/
import XCPlayground
@oznu
oznu / README.md
Last active April 30, 2024 20:58
How to Bootcamp / Dual Boot Windows 10 on a mid-2011 iMac using USB

How to Install / Bootcamp Windows 10 on a mid-2011 iMac using USB

Apple has released support for bootcamping Windows 10, but only on 2012 Macs and later. Despite not being supported. it is possible to install Windows 10 on earlier iMacs and it seems to run quite well.

IMPORTANT: Unplug all external and physical hard drives (where possible) that you won't be installing to to avoid accidentally erasing them. Also make note of which drives and partitions remain (e.g. System and Storage hard drives), and be super careful to not erase the wrong one.

RECOVERY: If you nuke your machine, restore your time machine backup. Instructions here.

Requirements

@AliSoftware
AliSoftware / struct_vs_inheritance.swift
Last active March 27, 2024 11:57
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
// #!Swift-1.1
import Foundation
// MARK: - (1) classes
// Solution 1:
// - Use classes instead of struct
// Issue: Violate the concept of moving model to the value layer
// http://realm.io/news/andy-matuschak-controlling-complexity/