Skip to content

Instantly share code, notes, and snippets.

<div class="sectionD" ng-repeat="employee in employees | limitTo: limitLength">
<img class="empImg" src="img/employee_images/{{employee.image}}">
<span class="textContent">
<span>{{employee.name.first +" "+employee.name.last + " " + employee.position}}</span>
</span>
</div>
<?php
/**
* Class convincenator
*
* Helps you to learn maths. Run this file from the command line
* and you will become convinced that 2+2 = 5.
*/
class convincenator
{
# found the solution here: http://ruby-doc.com/docs/ProgrammingRuby/html/tut_expressions.html
class Fixnum
alias actualPlus +
def +(other)
# gets the successor character which would be
# one digit higher than the result.
actualPlus(other).succ
// This code goes in your organization name loop
{{
$preference = getOrgPreference(organizationName, event.event.organization);
}}
// And this is for your controller.
/**
* checks the orgname from the current column against the orgs in the event
* and returns the preference for the matching organization
@RealShermanB
RealShermanB / Alphabetizerator
Created May 12, 2015 22:35
alphabetizerator
<?php
$word = "typewriter";
echo alphabetizerator($word);
/**
* Sorts a string passed to it in a more natural way.
*
* @param string $sort_me
@RealShermanB
RealShermanB / JSONRestDependency.php
Created August 21, 2014 17:45
This function will allow the JSON Rest API to run on older versions of WP.
/**
* This is an override for a function that ships in WordPress 3.9.0 and is
* required by the JSON REST API.
*/
if (!function_exists('current_action')) {
function current_action()
{
return current_filter();
}
}
<?php
function get_all_cpts_in_db() {
global $wpdb;
if ( false === ( $cpts = get_transient( 'all_cpts_in_db' ) ) {
$cpts = $wpdb->get_col( "SELECT DISTINCT( `post_type` ) FROM {$wpdb->posts}" );
set_transient( 'all_cpts_in_db', $cpts );
}
return (array) $cpts;
}
@RealShermanB
RealShermanB / MultiDomainContent.php
Last active December 30, 2015 03:48
Allow a single wordpress install to serve different content to different domains. This is version 0.0.0.0.1
<?php
/**
* This part resides in wp-config and is used to assign the domains
*
*/
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
function domain_theme($domain) {
define('WP_SITEURL', 'http://'.$domain);
@RealShermanB
RealShermanB / wp-config-debug.php
Last active December 30, 2015 03:39
A less intrusive but equally effective method of debug.
<?php
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', true);
if ( WP_DEBUG ) {
@RealShermanB
RealShermanB / gist:7424885
Created November 12, 2013 03:15
This is all you need in a walker class to change li elements to options.
<?php
// This is all you need in a walker class to change li elements to options.
class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$output .= sprintf( "\n<option value='%s'>%s</option>\n",
$item->url, $item->title
);
}
}