Skip to content

Instantly share code, notes, and snippets.

View rogden's full-sized avatar

Ryan Ogden rogden

View GitHub Profile
@rogden
rogden / single.php
Created August 28, 2018 17:49
Example of rendering template from Fractal in WordPress Theme
<?php
// https://fractal.build/
the_post();
get_header();
// render is a global function exposed to render templates from Fractal. @article is the template handle in Fractal. The
// Handlebars rendering engine has been setup to load templates from a pattern-library directory that contains the Fractal install.
render( '@article', [
@rogden
rogden / FractalMapLoader.php
Last active April 8, 2018 10:12
Using Fractal with Handlebars PHP
<?php
use Handlebars\Loader;
class FractalMapLoader implements Loader {
/**
* An array of @handle => component path mappings
* @var array
*/
@rogden
rogden / elevator_challenge.md
Last active April 13, 2018 15:37
Elevator Challenge

Elevator Challenge

Create a virtual elevator that meets the following requirements:

  1. Ability to select floor 1 to 10 on a keypad.
  2. There is a representation of an elevator and a building with 10 floors. This can be as simple as 10 blocks stacked on top of each other for the floors and a different colored block that represents the elevator.
  3. A current floor display shows what floor the elevator is currently on.
  4. Upon selecting a floor on the keypad
  • The selected floor button lights up
  • The elevator begins to move to the selected floor
@rogden
rogden / functions.php
Created August 6, 2016 18:37
Wordpress - Send email new post
<?php
// add to your theme's functions.php file
// _post can be any custom post type as well. I.E. if you have a book post type it would be 'save_post_book'
add_action( 'save_post_post', function( $post_ID, $post, $update ) {
// if it is an update and not a new post, return early
if ( $update ) return;
// a new post was created, send an email out
@rogden
rogden / fix.plist
Created December 7, 2015 20:01
Unity iOS iPad Multitasking support issue fix
Add the below to your apps/games info.plist file.
<key>UIRequiresFullScreen</key>
<true/>
@rogden
rogden / gist:11377139
Created April 28, 2014 16:31
Knockout Binding - templateFromChild
ko.bindingHandlers.templateFromChild = {
init: function (element, valueAccessor, allBindings) {
var selector = ko.unwrap(valueAccessor()),
tmpl;
// selector can either be an #ID or the string 'first' which just needs to save the first child as the template
if (selector === 'first') {
tmpl = ko.virtualElements.firstChild(element);
} else {
tmpl = document.getElementById(selector);
@rogden
rogden / gist:9745711
Last active July 25, 2016 21:44
Rising Underline on Hover Effect (LESS Mixin)
// @example: http://jsbin.com/huharale/1/edit?html,css,output
.rising-underline(@color, @thickness, @distance: 3px) {
position: relative;
text-decoration: none;
&:after {
content: "";
position: absolute;
@rogden
rogden / gist:5408123
Last active December 16, 2015 08:48
A Less Mixin for creating a heading with a flexible CSS doubled line background.
@rogden
rogden / gist:5327018
Last active December 15, 2015 21:39
Sublime Text 2 CSS comment banner style that shows up as a symbol in the goto symbol (cmd+r) menu. Makes for a good way to organize styles for various modules etc.
/*-------------------------------------------- */
/** My Module 1 */
/*-------------------------------------------- */
...
/*-------------------------------------------- */
/** My Module 2 */
/*-------------------------------------------- */