Skip to content

Instantly share code, notes, and snippets.

View iammilton82's full-sized avatar

Milton Jackson iammilton82

View GitHub Profile
<?php
public function getEmbedCode($url)
{
if (strpos($url, 'youtube') !== FALSE) {
$url_parts = parse_url($url);
parse_str($url_parts['query'], $segments);
return '//www.youtube.com/embed/' . $segments['v'];
} else if (strpos($url, 'vimeo') !== FALSE) {

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@iammilton82
iammilton82 / wp-pods-vs-ee.php
Created November 25, 2015 15:48 — forked from raybrownco/wp-pods-vs-ee.php
This file is a comparison between WordPress/Pods and ExpressionEngine. It shows the syntax required to display a list of three featured books on a site's homepage.
<!-- Featuring three books on a site's homepage -->
<!-- The Pods/WordPress way -->
<ul id="featured-books">
<?php
$book = new Pod('book');
$params = array(
'where'=>'t.show_on_homepage = 1',
@iammilton82
iammilton82 / memorySizeOfObject.js
Created January 7, 2017 17:35
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
<?php
//set up pods::find parameters to limit to 5 items
$param = array(
'limit' => 5,
);
//create pods object
$pods = pods('pod_name', $params );
//check that total values (given limit) returned is greater than zero
if ( $pods->total() > 0 ) {