Skip to content

Instantly share code, notes, and snippets.

pyrtsa / AnyEquatable.swift
Created May 25, 2016
AnyEquatable—making Equatable work with class inheritance and existential wrapping ("type erasure")
View AnyEquatable.swift
// Toggle this boolean to compare against stdlib:
#if true // Stdlib version
// Quick hack to avoid changing the AnyEquatable implementation below.
extension Equatable { typealias EqualSelf = Self }
#else // Modified version
protocol Equatable {
dhoerl / KeychainItemWrapper.h
Last active Jul 30, 2020
KeychainItemWrapper ARCified. Added the ability to manage a dictionary in place of just a string - the #define PASSWORD_USES_DATA in the .m file switches the mode.
View KeychainItemWrapper.h
File: KeychainItemWrapper.h
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
machty /
Last active Apr 16, 2020
How to do cool stuff with the new Router API
Marsup / reverse.js
Created Oct 31, 2013
Hapi reverse proxy
View reverse.js
var Hapi = require('hapi');
var server = new Hapi.Server('', 3000);
method: '*',
path: '/{path*}',
handler: {
proxy: {
host: '',
slindberg / ember-data.dependent-relations.js
Last active Mar 7, 2016
Dependent Relationships in Ember Data
View ember-data.dependent-relations.js
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
App.Thing = DS.Model.extend({
name : DS.attr('string'),
chrisyour / Remove Textmate 2 Cache
Created Jul 29, 2013
If your bundles start acting funny and aren't loading properly, you can always remove TextMate's cache and start again. For example, the basic HTML indenting features in Textmate 2 suddenly vanished on me along with some other HTML commands I use everyday. I removed the cache folder and restarted Textmate 2 and everything was back to normal.
View Remove Textmate 2 Cache
rm -rf ~/Library/Application\ Support/TextMate/Cache/*
machty /
Last active Dec 16, 2015
The smallest possible router refinement.


  1. No longer encourage/allow external calls to a Route's transitionTo method.
  2. Instead, make use of a new routeTo event, with the same semantics as transitionTo, only that it's an event that routes can respond to.
  3. ApplicationRoute will have a default routeTo handler which passes its args to an internal transitionTo.
  4. URL changes will be converted into a routeTo event event.
dmonagle /
Last active Dec 12, 2015
Ember mixins for CRUD functionality.
Ember.EditController = Ember.Mixin.create(
saveError: false
saveInvalid: false
isEditing: false
# Set associations to be associations of the content. These will then be checked for validity on save
# and all of the flags, such as isDirty and isLoaded, will take these associations into consideration.
# Eg: A user may have an address model which is edited within the same transaction.
# In this case you would put: