Skip to content

Instantly share code, notes, and snippets.

View escalant3's full-sized avatar

Diego Muñoz Escalante escalant3

View GitHub Profile

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@escalant3
escalant3 / gist:9783136
Last active August 29, 2015 13:57
Angular idiom to add extra methods to all the $scopes
angular.module('foo', [])
.config(function($provide) {
$provide.decorator('$rootScope', function ($delegate) {
// Shim needed for browsers I don't care about
var proto = Object.getPrototypeOf($delegate);
proto.$bar = function() {
// Do something
};
@escalant3
escalant3 / my-directive.js
Last active August 29, 2015 13:56
Angular controller inheritance in directives
angular.module('myModule')
.directive('myDirective', [
function() {
return {
controller: [
'$scope',
'$controller',
function($scope, $controller) {
angular.extend($scope, $controller('ParentCtrl', {$scope: $scope}));
@escalant3
escalant3 / tastypie_adapter.js
Created May 15, 2012 11:39
Django Tastypie Adapter
DS.DjangoTastypieAdapter = DS.RESTAdapter.extend({
/*
* Set this parameter if you are planning to do cross-site
* requests to the destination domain. Remember trailing slash
*/
serverDomain: "",
/*
* This is the default Tastypie url found in the documentation.