Skip to content

Instantly share code, notes, and snippets.

View dgeb's full-sized avatar

Dan Gebhardt dgeb

View GitHub Profile
@dgeb
dgeb / gist:4139842
Created November 24, 2012 14:14
hasManyEmbedded shim for ember-data
// This is a rather ugly shim that replaces the hasMany(..., {embedded: true})
// functionality that's been removed from ember-data. It is for read-only data.
// Embedded data support should eventually be added back into ember-data as an
// adapter concern.
(function() {
var get = Ember.get, set = Ember.set;
var hasEmbeddedAssociation = function(type, options) {
options = options || {};
@dgeb
dgeb / json-api-recommendations.md
Last active December 26, 2015 18:49
Recommendations for JSON API

Recommendations for JSON API

I'm planning a series of pull requests for JSON API, many of which are related to issues already raised on Github. I've summarized them here to emphasize common themes:

  • Center requests and responses upon primary resources and reference other resources relatively.
  • By default, make as few assumptions as possible about what the client wants.
  • Allow for a number of degrees of flexibility, all of which are optional, so that the client can customize the response.
  • Provide sufficient recommendations for common API design patterns to inform default implementations.

I touched on a lot of these topics in my talk "Building Ambitious APIs with Ruby" at the Burlington Ruby Conference this summer: video + slides

@dgeb
dgeb / orbit-ember-data-adapter.js
Last active January 3, 2016 10:08
A very simple example Orbit adapter implementation for Ember Data that's hard coded with a single Orbit.LocalStorageSource. Note that the Orbit schema could easily be auto-generated from DS models. Also, DS relationships would have to be mapped to Orbit links (and the adapter would need to call `link` / `unlink` methods on Orbit stores).
export default DS.Adapter.extend({
orbitSource: undefined,
init: function() {
this._super();
Orbit.Promise = Ember.RSVP.Promise;
// TODO - autogenerate schema from DS models
var schema = {
idField: 'id',
@dgeb
dgeb / context_test.js
Created May 28, 2014 17:10
Ember-Orbit RecordArray filtering
import Orbit from 'orbit';
import { RecordNotFoundException, RecordAlreadyExistsException } from 'orbit_common/lib/exceptions';
import attr from 'ember_orbit/attr';
import Context from 'ember_orbit/context';
import Store from 'ember_orbit/store';
import Model from 'ember_orbit/model';
import { createStore } from 'test_helper';
var get = Ember.get,
set = Ember.set;
@dgeb
dgeb / ember-cli-test-loader.md
Created September 10, 2014 20:19
ember-cli-test-loader.js

Definition of TestLoader as a class in ember-cli-test-loader:

(function() {
define("ember-cli/test-loader",
  [],
  function() {
    "use strict";

 var TestLoader = function() {

Keybase proof

I hereby claim:

  • I am dgeb on github.
  • I am dgeb (https://keybase.io/dgeb) on keybase.
  • I have a public key whose fingerprint is 52BC 4B26 AD09 81F5 EF37 4F2B 7A63 1487 1883 07BF

To claim this, I am signing this object:

@dgeb
dgeb / ember-engines-documentation.md
Created July 20, 2018 13:45
Ember Engines Documentation ToDos

Ember Engines Documentation ToDos

General

  • Almost all docs from README should be moved to ember-engines.com. Having similar but different info in both places is confusing and unmaintainable.

  • Consider using https://github.com/ember-learn/ember-cli-addon-docs to standardize the docs and guides and to make them version-specific.

  • Clarify the philosophy and intended uses for engines.

  • Is the "Why Use Engines?" section on http://ember-engines.com/ sufficient?

NY Bagels

Makes 8 bagels. Total time about 2 hours.

Dough ingredients:

  • 1.5 cups water
  • 1 tablespoon dry active yeast
  • 1 tablespoon granulated sugar
  • 1 tablespoon regular olive oil (pref. not extra virgin)
@dgeb
dgeb / ember-worker-talk.md
Last active August 24, 2022 09:00
Resources from my Sept 2019 talk at EmberCamp - "Worker Power!"

Worker Power!

Presentation by Dan Gebhardt at EmberCamp Chicago. September 16th, 2019.

Synopsis

Web workers bring a new layer of capabilities to web applications. Because workers operate on their own threads, they provide a way to perform processor-intensive tasks without affecting the responsiveness of an application. This talk will explore the different types of workers, including service workers and shared workers, and how to make the most of them in your Ember applications. We'll discuss the capabilities available to workers and explore different use cases, including progressive web apps.

Slides