Skip to content

Instantly share code, notes, and snippets.

View uberbruns's full-sized avatar

Karsten Bruns uberbruns

View GitHub Profile
tmpfile=$(mktemp)
prjfile=project.pbxproj
plutil -convert xml1 ${prjfile} -o - \
| plutil -replace "objects.071AC71E45E94004142F8190.includeInIndex" -string 2 -o - - \
| pl \
> ${tmpfile}
cat ${tmpfile} > ${prjfile}
rm -f ${tmpfile}
@uberbruns
uberbruns / app_manager.js
Last active February 25, 2018 12:05
A minimal js "framework" for extending server rendered html with bits of javascript.
import $ from "./query"
class AppManager {
constructor(viewControllerClasses) {
this.viewControllerClasses = viewControllerClasses
this.assemble()
}
// Find html nodes for the registered view controller classes.
import UIKit
// Message Type
struct Message<Target> {
let action: (Target) -> ()
init(_ action: (Target) -> ()) {
self.action = action
}
@uberbruns
uberbruns / german-passwords-xkcd-style
Created December 10, 2015 11:58
Generated german passwords (xkcd style)
// https://xkcd.com/936/
selbstgefälligste-darlehen-philosophieren-sprechfenster
verwitwete-pseudolegierung-vertrödele-fernfahrer
neuronale-videos-piepen-wanderführer
weihnachtliche-printen-erwachten-bambus
pejorativstes-palais-erklärte-übermacht
dekorativster-lutscher-schwante-halt
tugendsamste-ablichtung-verplant-truppe
vollmundigerer-boß-lindere-altersgrenzen
#search h3.r a[href*="www.w3schools.com"] {
pointer-events: none;
cursor: default;
}
#search h3.r a[href*="www.w3schools.com"]::after {
content: "";
position: absolute;
top: 0;
left: 0;
import Foundation
class BaseClass : Equatable {
var stringValue: String = ""
}
class SubClass : BaseClass {
var intValue: Int = 0
}
@uberbruns
uberbruns / popWebAPI.swift
Last active August 29, 2015 14:23
A draft on how to use Protocol-Oriented Programming in Swift 2 with a web API
import UIKit
// We define a APIResultType as something that can be generated from a JSON
protocol APIResultType {
init?(json: String)
}
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let rootViewController = RootViewController()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
var detailViewContoller: UIViewController?
if (segue.identifier == "ShowDetail") {
detailViewContoller = segue.destinationViewController as? UIViewController
} else if (segue.identifier == "ShowDetailWithNavigationController") {
let navigationController = segue.destinationViewController as UINavigationController
detailViewContoller = navigationController.viewControllers[0] as? UIViewController
}
override func shouldPerformSegueWithIdentifier(identifier: String!, sender: AnyObject!) -> Bool {
let needsNavigationController = (splitViewController.traitCollection.horizontalSizeClass == .Regular)
if identifier == "ShowDetail" && needsNavigationController {
performSegueWithIdentifier("ShowDetailWithNavigationController", sender: sender)
return false;
}
return super.shouldPerformSegueWithIdentifier(identifier, sender: sender)