Skip to content

Instantly share code, notes, and snippets.

Mateus seanlilmateus

View GitHub Profile
seanlilmateus / Example_Complex.swift
Last active Jul 30, 2020 — forked from IanKeen/Example_Complex.swift
PropertyWrapper: @transaction binding for SwiftUI to make changes to data supporting commit/rollback
View Example_Complex.swift
struct User: Equatable {
var firstName: String
var lastName: String
struct MyApp: App {
@State var value = User(firstName: "", lastName: "")
@State var showEdit = false
seanlilmateus /
Created Jul 19, 2020 — forked from ole/!
A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.
# Call this inside the bin directory of a build of the Swift compiler,
# e.g. build/Xcode-ReleaseAssert/swift-macosx-x86_64/Release/bin.
# Adjust the path to match your Xode installation or pick a different binary to dump.
# Tested with Xcode 12.0 beta 2.
# Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around.
# Because of ABI stability, I don't think the swift-reflection-dump version has to match
# the compiler version that was used to build the binary, but I'm not 100% sure.
seanlilmateus / StarPlane.swift
Created Jul 9, 2020 — forked from JohnSundell/StarPlane.swift
A simple game written in SwiftUI. Note that this is just a fun little hack, the code is not meant to be taken seriously, and only works on iPhones in portrait mode.
View StarPlane.swift
// A fun little game written in SwiftUI
// Copyright (c) John Sundell 2020, MIT license.
// This is a hacky implementation written just for fun.
// It's only verified to work on iPhones in portrait mode.
import SwiftUI
final class GameController: ObservableObject {
@Published var plane = GameObject.plane()
@Published private(set) var clouds = [GameObject]()
seanlilmateus / iOSCustomSegmentedControlSwiftUI.swift
Created May 24, 2020 — forked from frankfka/iOSCustomSegmentedControlSwiftUI.swift
Custom Segmented Picker / Segmented Control in SwiftUI
View iOSCustomSegmentedControlSwiftUI.swift
import SwiftUI
extension View {
func eraseToAnyView() -> AnyView {
struct SizePreferenceKey: PreferenceKey {
typealias Value = CGSize
View boilerplate.swift
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI {
VStack {
Text("Hello, World")
seanlilmateus / example-as.js
Created May 16, 2020 — forked from Tatsh/example-as.js
Example AppleScript in JavaScript.
View example-as.js
// Send a message to one person by name with
function sendMessageTo(name, message) {
var app = Application('Messages');
var chats = app.chats(); // Get all the chats, regardless of service
var theChat;
for (var i = 0, len < chats.length; i < len; i++) {
chat = chats[i];
if (chat.participants().length > 1) { // Ignore 'rooms'
View Creating Shazam in Java
A backup of just in case
Why is this necessary? Read
Please fork, tweet about, etc.
Creating Shazam in Java
A couple of days ago I encountered this article: How Shazam Works
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?
seanlilmateus / Calendar.swift
Created May 9, 2020 — forked from mecid/Calendar.swift
Calendar view in SwiftUI
View Calendar.swift
import SwiftUI
fileprivate extension DateFormatter {
static var month: DateFormatter {
let formatter = DateFormatter()
formatter.dateFormat = "MMMM"
return formatter
static var monthAndYear: DateFormatter {
seanlilmateus / AdbCommands
Created Aug 14, 2019 — forked from Pulimet/AdbCommands
Adb useful commands list
View AdbCommands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
seanlilmateus / combine.swift
Created Jun 20, 2019 — forked from broadwaylamb/combine.swift
Combine Generated Interface
View combine.swift
import Darwin
/// A type-erasing cancellable object that executes a provided closure when canceled.
/// Subscriber implementations can use this type to provide a “cancellation token” that makes it possible for a caller to cancel a publisher, but not to use the `Subscription` object to request items.
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
final public class AnyCancellable : Cancellable {
/// Initializes the cancellable object with the given cancel-time closure.
You can’t perform that action at this time.