- 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 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 | |
/** | |
* Generic WordPress Options Panel | |
* | |
* A good starting point for a simple options panel, just | |
* loops through defined options and creates input[type=text] | |
* for each with the value and lets you update. | |
* | |
* Replace namespace- and namespace_ with either your plugin |
This file contains 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
/** | |
* Quick and simple wrapper for Tiny PubSub (https://github.com/cowboy/jquery-tiny-pubsub). | |
* Wanted to be able to simply update an array with various events/classes/ids to watch for | |
* and have a single function fired. Also leverages Underscore.js (http://underscorejs.org/). | |
*/ | |
// What we want to watch for: key = event to listen for, value array = class/ids to watch for. | |
var eventsAndElementsToWatch = { | |
click: ['.btn','.link'], | |
change: ['.input'], |
This file contains 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%; |
This file contains 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 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 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 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 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 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))) |
OlderNewer