Skip to content

Instantly share code, notes, and snippets.

Eric Miller SimplGy

Block or report user

Report or block SimplGy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View swift-possible-bug-03.md

No Runtime Error:

func == (l: Car, r: Car) -> Bool { return l.vin == r.vin }
struct Car { let vin: String }
protocol hasDriversLicense: class {
  var car: Car? { get set }
}
class YoungPro: hasDriversLicense {
@SimplGy
SimplGy / hamming.go
Created Sep 4, 2016
A beautiful piece of code I didn't write
View hamming.go
// https://programmingpraxis.com/2011/08/30/hamming-numbers/
// cosmin said
// October 30, 2012 at 7:14 PM
// Another solution based upon Dijkstra’s paper:
def hammingSeq(N):
h = [1]
i2, i3, i5 = 0, 0, 0
for i in xrange(1, N):
x = min(2*h[i2], 3*h[i3], 5*h[i5])
View ubuntu-setup.sh
# Update the system's packages
apt-get update
apt-get upgrade
# Set up the `deploy` user
useradd deploy
mkdir /home/deploy
mkdir /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
usermod -s /bin/bash deploy
View Offline Album Art - Spotify Feature Request.md

If you use Spotify without cellular data, all you'll ever see for album art is a gray circle with a white musical note inside it.

image

I'm pretty familiar with spotify. Been a paid subscriber for a long time and visited Sweden, staying in the Jarl Birger hotel right under you guys. :)

Still, I never noticed how much I missed album art until one day I accidentally left cellular data on and chewed through a half gig of data.

I love album art. It's beautiful, connects me to the band, and I always want to see it.

@SimplGy
SimplGy / Wrap+Unbox+Symmetrical.swift
Last active May 17, 2016
An Experiment working on Enforced Symmetricality with JohnSundell's Wrap+Unbox
View Wrap+Unbox+Symmetrical.swift
//
// A definition for the kind of model objects this library can work on
//
import Foundation
public protocol CollieModel: Unboxable, WrapCustomizable, Hashable, CustomStringConvertible {
/// Configure the mapping between client and server property names. keys are client names and values are JSON names eg: "authorId: "author_id"
static var propertyMapping: [String: String]? { get }
@SimplGy
SimplGy / optionalEnum.swift
Last active Jul 19, 2016
Switching on optional enums
View optionalEnum.swift
enum Coin {
case heads
case tails
}
var result: Coin?
// You can pattern match against it like an optional:
switch result {
case .heads?: print("heads")
case .tails?: print("tails")
@SimplGy
SimplGy / openDeepLink.swift
Last active Mar 24, 2016
Opens a deep link into an app (Waitress). If that app isn't installed, open the app store for the app instead. Encode a back link into the app open url so the target app can navigate back to this app.
View openDeepLink.swift
@SimplGy
SimplGy / jekyll-cheat-sheet.md
Last active Mar 17, 2016
Jekyll Cheat Sheet
View jekyll-cheat-sheet.md

Jekyll Cheat Sheet

Preview posts

Add a _drafts folder as a sibling of _posts. You add posts inside it the same way. To preview drafts, start jekyll with jekyll s --wD. The D is for Drafts.

Categorize blog posts

Jekyll only allows one category per post. You can apply the category by front matter or subfolder, but subfolder never gets forgotten so it's recommended. If you need more than one "something" per post, create a separate front matter field:

@SimplGy
SimplGy / logVCinitAndDeinit.swift
Created Feb 12, 2016
Sometimes you need to make sure init and deinit happen in the right order on your View Controllers, and you don't stand up two at once.
View logVCinitAndDeinit.swift
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
print("init nibName: \(self) \(unsafeAddressOf(self))")
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
print("init coder: \(self) \(unsafeAddressOf(self))")
}
deinit {
print("deinit coder: \(self) \(unsafeAddressOf(self))")
@SimplGy
SimplGy / apple-app-site-association
Last active Dec 20, 2015
Waitress app site assoc file
View apple-app-site-association
{
"applinks": {
"apps": [],
"details": [
{
"appID": "68Q8TRPLTN.com.waitress.ios",
"paths": [ "/place/*" ]
}
]
}
You can’t perform that action at this time.