Skip to content

Instantly share code, notes, and snippets.

View pisarm's full-sized avatar

Flemming Pedersen pisarm

View GitHub Profile
@pisarm
pisarm / AppInfo.swift
Created February 2, 2018 13:00
Info dictionary wrapper
import Foundation
public enum AppInfoError: Error {
case keyNotFound(key: String)
case incorrectType(type: String)
}
extension AppInfo.Key {
public static let bundleIdentifier = AppInfo.Key("CFBundleIdentifier")
public static let bundleShortVersion = AppInfo.Key("CFBundleShortVersionString")
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@pisarm
pisarm / HockeyApp.playground.swift
Created August 19, 2016 21:04
Partial implementation of the HockeyApp api in a Swift playground, inspired by Networking(#1) episode from https://talk.objc.io
/*
Partial implementation of the HockeyApp api, inspired by Networking(#1) episode from https://talk.objc.io
** Remember to add your own authentication token! **
*/
import UIKit
import PlaygroundSupport
//MARK: Playground setup
@pisarm
pisarm / README-Template.md
Created August 10, 2016 20:58 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisities

//
// Displayable.swift
// Gist
//
// Created by Flemming Pedersen on 10/12/15.
// Copyright © 2015 pisarm.dk. All rights reserved.
//
import Foundation
import UIKit
//
// DataSource.swift
// Fridgy
//
// Created by Flemming Pedersen on 20/04/16.
// Copyright © 2016 pisarm.dk. All rights reserved.
//
import Foundation
import UIKit
class Foo {
var messageReceivers: [MessageReceivers]
func Bar(@autoclosure msg: () -> String) {
var message: String?
messageReceivers.forEach {
if $0.shouldReceiveMessage() {
if (message == nil) {
message = msg() //This is could be a costly operation - only want to do this if necessary
@pisarm
pisarm / generate_icon_assets.sh
Created January 3, 2016 00:56
Generates the needed Xcode app icon assets from one source .png file
#!/bin/bash
f=$(pwd)
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-29.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/Icon-29@2x.png"
sips --resampleWidth 87 "${f}/${1}" --out "${f}/Icon-29@3x.png"
sips --resampleWidth 40 "${f}/${1}" --out "${f}/Icon-40.png"
sips --resampleWidth 80 "${f}/${1}" --out "${f}/Icon-40@2x.png"
sips --resampleWidth 120 "${f}/${1}" --out "${f}/Icon-40@3x.png"
@pisarm
pisarm / keybase.md
Last active September 13, 2019 06:27

Keybase proof

I hereby claim:

  • I am pisarm on github.
  • I am pisarm (https://keybase.io/pisarm) on keybase.
  • I have a public key ASCrGnzhClajI7OBL8szEZKB9ETtAM3EKe-IH2N7t4gxewo

To claim this, I am signing this object: