Skip to content

Instantly share code, notes, and snippets.

View Jmayhak's full-sized avatar

Jonathan Mayhak Jmayhak

View GitHub Profile
case ($invoice->hasSilverMembership() && $invoice->hasSpouseProduct()) :
$content_name = 'Silver + Spouse';
$value = 194;
break;
case ($invoice->hasGoldMembership() && $invoice->hasSpouseProduct()) :
$content_name = 'Gold + Spouse';
$value = 294;
break;
case ($invoice->hasPlatinumMembership() && $invoice->hasSpouseProduct()) :
$content_name = 'Platinum + Spouse';
@Jmayhak
Jmayhak / gist:59ed2f1e708fbd8e0164
Last active August 29, 2015 14:20
local MAMP setup
// You should be using MAMP (not pro) as your local server. Set up wildcard virtual hosts in MAMP. Put the following in
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
<Virtualhost *:80>
VirtualDocumentRoot "/Users/[username]/Sites/%1/"
ServerName vhosts.[username].dev
ServerAlias *.[username].dev
UseCanonicalName Off
<Directory "/Users/[username]/Sites/*">
@Jmayhak
Jmayhak / 0_reuse_code.js
Created June 2, 2014 14:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Jmayhak
Jmayhak / links.txt
Created November 16, 2012 13:42
rsi dev links
@Jmayhak
Jmayhak / relation.m
Created August 25, 2012 23:08
create pfobject relation
PFObject *myPost = [PFObject objectWithClassName:@"Post"];
[myPost setObject:@"I'm Hungry" forKey:@"title"];
[myPost setObject:@"Where should we go for lunch?" forKey:@"content"];
// Create the comment
PFObject *myComment = [PFObject objectWithClassName:@"Comment"];
[myComment setObject:@"Let's do Sushirrito." forKey:@"content"];
// Add a relation between the Post and Comment
[myComment setObject:myPost forKey:@"parent"];
@Jmayhak
Jmayhak / gender.php
Created June 7, 2012 14:43
php functions to get gender
<?php
define('GENDER_MALE', 'm');
define('GENDER_MALE_FULL', 'male');
define('GENDER_FEMALE', 'f');
define('GENDER_FEMALE_FULL', 'female');
define('GENDER_UNKNOWN', 'u');
define('GENDER_UNKNOWN_FULL', 'unknown');
function isValidGender($gender)
@Jmayhak
Jmayhak / example.php
Created February 2, 2012 17:07
Permission checks at the handler level example
<?php
namespace EFNEP\Controllers;
class UserApi extends Api
{
/**
* Sets the url and data and tells Walleye what the handlers accept
*
* @param array $url
@Jmayhak
Jmayhak / implode_by_key.php
Created July 13, 2011 22:24
A php function to implode an array full of arrays by a key in each of the arrays
<?php
/**
* Implodes an array full of arrays based on the passed key that is in each element of the array
* by the passed delimiter
*
* implode_key(',', array(array('title'=>'jonathan'), array('title'=>'justin')), 'title')
* // will return "jonathan,justin"
*
* @param string $delimiter
@Jmayhak
Jmayhak / get flurry data
Created June 30, 2011 00:03
pull all flurry data for your platforms
#!/usr/bin/php
<?php
// NOTE: create a folder for each metric. ./ActiveUsers and ./NewUsers and etc
$appMetrics = array('ActiveUsers', 'NewUsers', 'MedianSessionLength', 'AvgSessionLength', 'Sessions', 'RetainedUsers');
// define your platforms as listed in Flurry
$platforms = array();
@Jmayhak
Jmayhak / convert
Created May 30, 2011 05:03
Convert mysql dump file to ruckusing migration php
#!/usr/bin/php
<?php
$string = file_get_contents(dirname(__FILE__) . '/efnep_global_dev_2011-05-26.sql');
preg_match_all('/CREATE TABLE `(\w*)` \(\s( `(\w*)` .*\s)*/', $string, $matches);
$matches_sql = $matches[0];
$php_code = '';
$drop_coe = '';