Skip to content

Instantly share code, notes, and snippets.

@dmonagle
dmonagle / ember_crud.coffee
Last active December 12, 2015 12:39
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:
@machty
machty / router.md
Last active December 16, 2015 00:49
The smallest possible router refinement.

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.
@chrisyour
chrisyour / Remove Textmate 2 Cache
Created July 29, 2013 19:31
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.
rm -rf ~/Library/Application\ Support/TextMate/Cache/*
@Marsup
Marsup / reverse.js
Created October 31, 2013 21:23
Hapi reverse proxy
var Hapi = require('hapi');
var server = new Hapi.Server('0.0.0.0', 3000);
server.route({
method: '*',
path: '/{path*}',
handler: {
proxy: {
host: 'amazon.com',
@machty
machty / new-router-examples.md
Last active April 16, 2020 22:03
How to do cool stuff with the new Router API
@pyrtsa
pyrtsa / AnyEquatable.swift
Created May 25, 2016 10:27
AnyEquatable—making Equatable work with class inheritance and existential wrapping ("type erasure")
// 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 November 5, 2021 21:41
Dependent Relationships in Ember Data
/**
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'),
@dhoerl
dhoerl / KeychainItemWrapper.h
Last active April 4, 2023 08:15
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.
/*
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