Skip to content

Instantly share code, notes, and snippets.

View schmittsfn's full-sized avatar
🔁
programming / learning ∞ rinse repeat

Stefan schmittsfn

🔁
programming / learning ∞ rinse repeat
View GitHub Profile
@schmittsfn
schmittsfn / gist:6c6a65d9253b14487deaa6f16e206b45
Last active October 8, 2020 17:20
CarPlaySceneDelegate of CarPlay Parking App
import CarPlay
import Foundation
@available(iOS 14.0, *)
final class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
var interfaceController: CPInterfaceController?
var coordinator: CarPlayBaseCoordinator?
// CarPlay connected
@schmittsfn
schmittsfn / Queue.swift
Last active February 24, 2020 16:36
A list of Queue data types for swift
import Foundation
protocol Queuable {
associatedtype T
var items: [T] { get set }
}
extension Queuable {
mutating func enqueue(element: T) {
@schmittsfn
schmittsfn / BinaryImagesInspector.swift
Last active August 19, 2019 13:51
Generates an array of strings containing info on the loaded binary images at runtime. Useful for symbolicating stack traces using the atos command for example.
// Copyright (c) 2019 sts2055
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all

iOS Quiz

Swift

  1. What is the difference between var and let ?
  • let is a constant variable and thus can be assigned once only -- its value is immutable.
  • var is a variable that can be assigned multiple times -- its value is therefore mutable.
  1. What is an Optional? What happens when using the if let syntax?
  • An Optional is a wrapper around an object instance that returns nil when said instance doesn't have a valid value.
  • Using if let allows you to test an Optional instance against nil and change control flow depending on the result. The process of assigning an Optional to a variable inside a conditional statement is called 'Optional Binding'.
@schmittsfn
schmittsfn / IOMobileFramebuffer.h
Created March 21, 2017 14:16 — forked from anthonya1999/IOMobileFramebuffer.h
A recent disassembly of IOMobileFramebuffer framework
/* It is recommended to use dlopen & dlsym to call these functions, and use this header as a reference.
Example:
void *IOMobileFramebuffer = dlopen("/System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer", RTLD_LAZY);
IOMobileFramebufferReturn (*IOMobileFramebufferGetMainDisplay)(IOMobileFramebufferRef *pointer) = dlsym(IOMobileFramebuffer, "IOMobileFramebufferGetMainDisplay");
dlclose(IOMobileFramebuffer); */
/* You may have to include your IOSurface header to compile, because of the IOMobileFramebufferGetLayerDefaultSurface function. If you do not have it, you may just uncomment the typedef to an IOSurface below. */
#include <stdio.h>
#include <sys/mman.h>
#include <mach/mach.h>
package net.hockeyapp.android;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.util.Date;
import java.util.UUID;