Skip to content

Instantly share code, notes, and snippets.

Moz Morris mozmorris

Block or report user

Report or block mozmorris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mozmorris
mozmorris / actions.js
Created Sep 15, 2016
Example of generating request (fetch, success, failure) flux actions
View actions.js
const REQUEST = 'REQUEST';
const SUCCESS = 'SUCCESS';
const FAILURE = 'FAILURE';
/**
* Returns request constants (request, success, failure) for a given action
* @param {String} action The request action (e.g. GET_CUSTOMER)
* @return {object} Object containing the contstants
*/
function constantsCreator(action) {
View init.coffee
# 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 ->
@mozmorris
mozmorris / composer.json
Last active Jul 8, 2016
example php app using php's built-in server (npm run backend)
View composer.json
{
"name": "MozMorris/phpapp",
"require": {
"slim/views": "~0.1.3",
"twig/twig": "~1.0"
}
}
@mozmorris
mozmorris / com.mozmorris.StaticRoutes.plist
Created Mar 3, 2014
Create static routes on login (doesn't work unfortunately)
View com.mozmorris.StaticRoutes.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mozmorris.StaticRoutes</string>
<true/>
<key>ProgramArguments</key>
<array>
<string>sh</string>
@mozmorris
mozmorris / redirect_to_child.php
Last active Dec 16, 2015
Redirect to first child WordPress template
View redirect_to_child.php
<?php
/*
Template Name: Redirect to First Child
*/
$children = get_pages( "child_of=" . $post->ID . "&sort_column=menu_order" );
if ($children) {
wp_redirect( get_permalink( $children[0]->ID ) );
}
@mozmorris
mozmorris / expires.php
Created Feb 11, 2013
CakePHP "Expires" behavior. Works with 1.2. I don't think any changes are required to get it working with 2.0. Ensure you've added `expiry_date` (DATE) column to your model table.
View expires.php
<?php
class ExpiresBehavior extends ModelBehavior {
protected $_defaults = array(
'field' => 'expiry_date'
);
/**
* Setup this behavior with the specified configuration settings.
@mozmorris
mozmorris / fix.md
Created Feb 2, 2013
Fix RubyGems on CentOS after installation with Vagrant & Chef
View fix.md

Depending on the box used for the VM, the version of RubyGems might need updating. On the first attempt trying to install the Sinatra gem, I received the following message:

WARNING: RubyGems 1.2+ index not found for: http://rubygems.org/

Well 1.2 is out of date, let's fix that:

$ sudo gem update --system

On the second attempt, I got this error:

@mozmorris
mozmorris / ExtendedFormAuthenticate.php
Created Jan 5, 2012
ExtendedFormAuthenticate class that overrides CakePhp's FormAuthenticate class
View ExtendedFormAuthenticate.php
<?php
App::uses('FormAuthenticate', 'Controller/Component/Auth');
class ExtendedFormAuthenticate extends FormAuthenticate
{
public function authenicate(CakeRequest $request, CakeResponse $response) {
$userModel = $this->settings['userModel'];
list($plugin, $model) = pluginSplit($userModel);
$fields = $this->settings['fields'];
You can’t perform that action at this time.