Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Miller SimplGy

View GitHub Profile
@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 / 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 / app.analytics.coffee
Last active Jan 4, 2016
Abstraction for an SPA's Analytics Library
View app.analytics.coffee
define(
[]
() ->
_analyticsSites =
DEMO: 1
LOCALHOST: 2
_libUrl = (server) ->
'js!' + server + '/js/piwik.js'
@SimplGy
SimplGy / rotationalCipher.rb
Created Oct 10, 2013
Ruby Implementation of a Rotational Cipher. Wrote in https://coderpad.io/966172
View rotationalCipher.rb
$ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
$alphabet = 'abcdefghijklmnopqurstvwxyz'
# Get an index of an alphabetic letter based on the index and offset
def calculateOffset(index, offset)
index += offset
index -= 26 while index >= 26 # keep subtracting until we get to the right range
index
end
@SimplGy
SimplGy / algorithm test
Created Aug 30, 2013
Favorite unit test yet :) Uses a loop over a hash to test expectations
View algorithm test
define [
'./circles'
],
(
Circles
) ->
_data = [
{ size: 2 }
{ size: 2 }
@SimplGy
SimplGy / 2xBackground
Created Aug 12, 2013
Creates 1x and 2x background images. The 200% means that the pixel offsets will work on both the small and large images. Make sure your sprites line up exactly, so that the 2x images are exactly twice as big, twice as low, and twice as left.
View 2xBackground
//Support 1 and 2x image sizes
@mixin 2xBackground($url)
background-image: url($url + ".png")
@media only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)
background-image: url($url + "@2x.png")
background-size: 200%
@SimplGy
SimplGy / screenSizeHelpers.sass
Last active Dec 20, 2015
Allows you to use simple block statements to conditionally target +phone, +desktop, and +tablet
View screenSizeHelpers.sass
$sizePhone: 603px
$sizeTablet: 1024px
@mixin phone
@media (max-width: $sizePhone)
@content
@mixin tablet
@media (min-width: $sizePhone+1) and (max-width: $sizeTablet)
@content
@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.