Skip to content

Instantly share code, notes, and snippets.

View sebastianseilund's full-sized avatar

Sebastian Seilund sebastianseilund

View GitHub Profile

Userflow direct integration Group call

userflow.group(
  '123id',
  {
    name: 'Acme Inc.',
    plan: 'enterprise',
    // ... other group-level attributes
 },
@sebastianseilund
sebastianseilund / fastboot-fix.js
Created May 16, 2016 13:32
Mega hack warning! Use at own risk and make sure to remove this patch again as soon as proper FastBoot rootURL is implemented.
//app/instance-initializers/fastboot-fix.js
import Ember from 'ember'
const {get, RSVP, run} = Ember
export default {
name: 'fastboot-fix',
initialize: function(instance) {
fixNoneLocation(Ember.NoneLocation)
fixApplicationInstance(instance)
@sebastianseilund
sebastianseilund / billy-api-v2-docs.md
Last active September 3, 2018 00:34
Simple documentation for the beta of API v2. We are working on getting our new real API docs online.
@sebastianseilund
sebastianseilund / merged_array.js
Last active December 20, 2015 07:58
An implementation of a merged array in Ember.js that combines items from multiple source arrays so you can easily list them together in your Handlebars templates. Read the blog post at the [Billy's Billing Developer Blog](http://dev.billysbilling.com/blog/How-to-merge-multiple-data-sources-into-one-array-in-Ember-js)
/**
* `Ember.MergedArray` is an array that observes multiple other arrays (called source arrays) for changes and includes
* all items from all source arrays in an efficient way.
*
* Usage:
*
* ```javascript
* var obj = Ember.Object.create({
* people: [
* {
@sebastianseilund
sebastianseilund / async-router-notes-june-1st.md
Last active December 17, 2015 23:58
Sebastian's notes on async router to Alex

Current issues

These are the things that I don't believe is totally consistent and things I think might give problems in different situations. We don't have to solve them all, but make sure that we don't get ourselves into something that's going to be hard to solve.

  • .dispatch (or .perform, .resend or whatever we're gonna call it) needs to be supported in a consistent way.
    • Retrying with previously rejected promises.
    • Should contain the full target route path. It doesn't matter where it came from.
    • Does TransitionEvent replicate itself, or does it have an EventDescriptor that can be reused? Important thing is that we don't reuse the same TransitionEvent instance, as this will mean trouble regarding isAborted and resolved contexts.
    • How do you put extra state on a TransitionEvent that must survive after calling .dispatch? Do you just add properties to it, or should it have a data property that you need to add properties about the transition to (e.g. `transitionEven
@sebastianseilund
sebastianseilund / things.md
Last active December 17, 2015 11:28
Ember Data vs. Billy Data

Billy Data is not as lightweight as Ember Model or Ember Resource. It is a full data framework. I'm pretty sure it can do at least 95% of what Ember Data can do, except for custom adapters/serializers. Here are some important differences and a couple of features I find useful.

Record arrays

Filtered record array that updates live. Also works with sorting, so that records are inserted at the correct position. Say you have a filtered record array of Person records with name "Tom" ordered by name. Anytime a Person record changes its name property, it is checked against all filtered record arrays that "observe" that property. Then it will be either added or removed. And if you change your name to Atom Dale, your Person record will be moved to the top of the list.

Sparse array support. A record array can query the server and get e.g. the first 100 records and a totalCount. The length property will be set to the totalCount from the response, and every time an index is requested the array loads 10