Skip to content

Instantly share code, notes, and snippets.

@pronebird
pronebird / CoreDataPlayground-v2.swift
Created July 11, 2016 19:43
Sample CoreData Playground with relationships
// Playground is where kids play biatch
import CoreData
@objc(City)
class City: NSManagedObject {
@NSManaged var name: String
@NSManaged var streets: NSSet
}
@zkwentz
zkwentz / adapters.application.js
Last active July 26, 2016 14:24
Difference in Promised Properties
import DS from 'ember-data';
export default DS.FixtureAdapter.extend({});
@julienbourdeau
julienbourdeau / commit-message-convention.md
Created May 2, 2016 12:02
The seven rules of a great git commit message

Source: http://chris.beams.io/posts/git-commit/#seven-rules

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how
import { helper } from 'ember-helper';
import $ from 'jquery';
export default helper(function([selector, handler]) {
return function(event) {
if ($(event.target).is(selector) && handler) {
return handler(event);
}
};
});
@MichalZalecki
MichalZalecki / index.js
Created March 12, 2016 12:24
How to import RxJS 5
// Import all
import Rx from "rxjs/Rx";
Rx.Observable
.interval(200)
.take(9)
.map(x => x + "!!!")
.bufferCount(2)
.subscribe(::console.log);
@whiteinge
whiteinge / rxjs-spinner-poc.js
Created March 2, 2016 05:56
Render a spinner while waiting for an ajax response using RxJS
// Central xhr progress tracker. Used for both a global
// activity indicator as well as granular spinners within in a page.
var Progress$ = new Rx.Subject();
// Make an xhr call and make a tag to track the progress ticks.
var users$ = Rx.DOM.ajax({
method: 'GET',
url: 'https://api.github.com/users',
responseType: 'json',
progressObserver: Rx.Observer.create(
import DS from 'ember-data';
export default DS.FixtureAdapter.extend();
import DS from "ember-data";
export default DS.JSONAPIAdapter.extend({
urlForCreateRecord: function(type, snapshot) {
var url = this._super(...arguments);
var includes = snapshot.adapterOptions.includes;
if (includes) {
url += `?includes=${includes}`;
}
@j-
j- / application.controller.js
Created January 7, 2016 05:43
Ember computed sort
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {