Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Rucker seanrucker

View GitHub Profile
@pyrtsa
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 {
@slindberg
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.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
@Marsup
Marsup / reverse.js
Created Oct 31, 2013
Hapi reverse proxy
View reverse.js
var Hapi = require('hapi');
var server = new Hapi.Server('0.0.0.0', 3000);
server.route({
method: '*',
path: '/{path*}',
handler: {
proxy: {
host: 'amazon.com',
@chrisyour
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
machty / new-router-examples.md
Last active Apr 16, 2020
How to do cool stuff with the new Router API
@machty
machty / router.md
Last active Dec 16, 2015
The smallest possible router refinement.
View router.md

Proposal

  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
dmonagle / ember_crud.coffee
Last active Dec 12, 2015
Ember mixins for CRUD functionality.
View ember_crud.coffee
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:
@dhoerl
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
Abstract:
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
You can’t perform that action at this time.