- Clear feature ownership
- Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| const Rx = require('rx'); | |
| const fetch = require('isomorphic-fetch'); /* use the fetch api on client and server */ | |
| /** | |
| * Given a subreddit, pull down post ids. that is, changing the subreddit by calling terms$.onNext(SUBREDDITNAME) | |
| * automatically calls the reddit api and populates the store. | |
| * To try it out, npm install rx and isomorphic-fetch, then | |
| * var S = require('./index.js'); | |
| * S.store$.subscribe(x => console.log(x)); // listen to every state change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Explicit in-out of side-effect actions. | |
| function epic(action$, store) { | |
| const fooReq$ = action$.ofType('FOO') | |
| .map(action => call('FOO_REQ', webapi.getFoo, action.payload.id)); | |
| const foo$ = action$.ofType('FOO_REQ') | |
| .map(foo => ({ type: 'FOO_FETCHED', payload: { foo } })); | |
| return Observable.merge( | |
| fooReq$, | |
| foo$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import update from 'react/lib/update' | |
| import { Observable, Subject, ReplaySubject } from 'rx' | |
| const INITIAL_STATE = { | |
| user: null | |
| } | |
| const updates = new ReplaySubject() | |
| export const state = Observable.of(INITIAL_STATE) | |
| .merge(updates.map(change => state => update(state, change))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| angular.module('core') | |
| // Persistent filter, runs on any ng-repeat. | |
| .filter('PersistentFilter', ['_', 'PersistentFilterStorage', | |
| function (_, PersistentFilterStorage) { | |
| var pfs = PersistentFilterStorage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ | |
| /** | |
| * Emulates ng-show for focus, i.e.: | |
| * | |
| * <input ng-focus="truthyValue"> | |
| * | |
| * Setting truthyValue to true focuses said input. | |
| */ | |
| app.directive('ngFocus', function($timeout){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Small factory for accessing WP backend AJAX. Best used with the built in admin-ajax.php | |
| * calls. | |
| * | |
| * Controller example: | |
| var myApp = angular.module('myApp', [ 'WP' ]); | |
| myApp.controller('myCtrl', function($scope, WPAjax){ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'is_protected_meta', 'hide_meta_data', 10, 2 ); | |
| /** | |
| * Set our metadata to be protected, will not be seen in administration, | |
| * unless the plugin is deactivated. | |
| * @param array $protected protected values | |
| * @param string $meta_key current meta key | |
| * @return string/bool $protected or true to add |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Liked what Chris Coyier showed off in this blog post: | |
| // http://codepen.io/chriscoyier/blog/some-mini-sass-mixins-i-like | |
| // Decided to make LESS versions really quickly. | |
| .coverer() { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; |