Skip to content

Instantly share code, notes, and snippets.

View taras's full-sized avatar

Taras Mankovski taras

View GitHub Profile
var path = require('path');
var fs = require('fs');
var globSync = require('glob').sync;
var yaml = require('js-yaml');
module.exports = function(folder) {
var files = globSync(path.join(folder, '**/*.yaml'));
var data = {};
@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'),

There are several types of relationships.

  • OneToMany
  • OneToOne
  • OneToNone
  • ManyToNone

A OneToMany relationship has a Set of members and a link to the belongsTo. Each member and the belongsTo has a link back to the relationship. The member links can change.

A ManyToNone relationship has a Set of members and a link to the belongsTo. The belongsTo has a link back to the relationship. The link doesn't change.

@wycats
wycats / app.js
Last active February 11, 2016 16:08
App.Router.map(function() {
this.resource('post', { path: '/posts/:post_id' });
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('post', params.post_id);
}
});
@mattpodwysocki
mattpodwysocki / pausable.js
Last active December 31, 2015 04:49
Pause/resume semantics on an Observable.
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
var self = this;
var get = Ember.get, set = Ember.set, doc = document;
var FastSelectComponent = Ember.Component.extend({
items: null,
valuePath: 'value',
labelPath: 'label',
value: null,
selected: null,
tagName: 'select',
@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: [
* {
@mikeschinkel
mikeschinkel / class-custom-hooks.php
Last active June 17, 2021 04:42
Classes providing "hooks" (actions and filters) that work with WordPress or free-standing PHP-based apps.
<?php
class Custom_Hooks {
/**
* Adds a filter hook for an object
*
* Custom_Hooks::add_filter( 'filter_data', array( $this, 'filter_data' ) );
* Custom_Hooks::add_filter( 'filter_data', array( $this, 'filter_data' ), 11 );
* Custom_Hooks::add_filter( 'filter_data', 'special_func' );
* Custom_Hooks::add_filter( 'filter_data', 'special_func', 11 );
@tim-evans
tim-evans / autosave.js
Created June 14, 2013 16:03
Autosave pattern for Ember with Ember Data
(function () {
// Implement debounce until backburner implements a proper debounce
var debouncees = [],
pop = Array.prototype.pop;
var debounce = function (target, method /*, args, wait */) {
var self = Ember.run.backburner,
args = arguments,
wait = pop.call(args),
@machty
machty / router-facelift-guide.md
Last active November 11, 2023 06:44
Guide to the Router Facelift

Ember Router Async Facelift

The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.