Skip to content

Instantly share code, notes, and snippets.

View oligriffiths's full-sized avatar

Oli Griffiths oligriffiths

View GitHub Profile
class Plugin
{
shouldBuild() {
return this.inputs.hasChanges();
}
build() {
for (let input of this.inputs) {
input.readFileSync('path/to/file');
}
@oligriffiths
oligriffiths / ember-ember data.md
Last active March 2, 2018 16:20
Thoughts on removing ember data from ember

The problem

Ember currently ships with ember data, and it is assumed that you will be using ember data within your application. The getting started guides also make the same assumption, and introduce ember data, before even mentioning that one can return a POJO or a promise that returns a POJO, for example an ajax request.

This contributes to the cognitive load of "learning ember" and I believe contributes substantially to the "steep learning curve" associated with learning ember. Ember data is indeed, a relatively complex product, with at least 4 core concepts to learn (models, store, adapters, serializers). To make matters worse, if your API isn't a nicely structure JSON-API, you're in for a hard time whilst you naviagte the ember data documentation to work out what to do. All of this is unnecessary to a new adopter to ember, and is likely to scare them off the framework entirely.

Background

Whilst some colleagues of mine worke

@oligriffiths
oligriffiths / ember-tumblr-addons.md
Last active January 14, 2018 05:26
Ember.js addons we've been using at Tumblr
import Ember from 'ember';
import RSVP from 'rsvp';
//Make object proxy for promise
const ObjectPromiseProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
/**
* Returns a computed property that combines all dependent
* promises into an RSVP hash, which when resolves, calls
@oligriffiths
oligriffiths / gist:5940720
Created July 6, 2013 18:12
Koowa default plugin
<?php
/**
* @version $Id$
* @package Nooku_Plugins
* @subpackage Koowa
* @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.nooku.org
*/
@oligriffiths
oligriffiths / gist:5940659
Last active December 19, 2015 10:29
Docman example plugin
<?php
/**
* @package Koowa.Plugin
* @subpackage Docman
*
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('KOOWA') or die;
(function($){
var filters = {
int: function(value){return typeof parseInt(value) !== 'NaN' ? parseInt(value) : null},
float: function(value){return typeof parseFloat(value) !== 'NaN' ? parseFloat(value) : null},
string: function(value){return ['string','boolean','number'].indexOf(typeof value) !== -1 ? value+'' : null},
array: function(value){return typeof value === 'object' && value.constructor === Array ? value : null},
object: function(value){return typeof value === 'object' ? value : null}
}
# Remove remote references that have been deleted
git fetch -p
# Remove local branches that have been merged
git branch --merged | grep -v master | xargs git branch -d
<?php
namespace Nooku\Component\Overrides;
use Nooku\Library;
use Nooku\Component\Users;
class UsersDispatcherAuthenticatorFacebook extends Library\DispatcherAuthenticatorAbstract
{
/**
* A redirect url
@oligriffiths
oligriffiths / cacheable.php
Last active August 29, 2015 14:16
A cachable model behavior for Nooku Platform
<?php
/**
* User: Oli Griffiths
* Date: 06/03/15
* Time: 09:53
*/
namespace Oligriffiths\Component\Foursquare;
use Nooku\Library;