Skip to content

Instantly share code, notes, and snippets.

View ChrisFrench's full-sized avatar

Chris French ChrisFrench

  • Hellosign / Dropbox
  • San Diego, CA
View GitHub Profile
<?php
$user1 = (new \Api\Site\Models\Attendees)->setState('filter.id',$id1)->getItem();
$user2 = (new \Api\Site\Models\Attendees)->setState('filter.id',$id2)->getItem();
//set user one
$connections = $user1->connections;
$connections[$id2] = array('name' => $user2->fullName(), 'time' => date("Y-m-d H:i:s"));
$user1->set('connections', $connections);
$user1->save();
//set user two
$connections = $user2->connections;
@ChrisFrench
ChrisFrench / gist:2fea8addb08e674902fd
Created May 20, 2014 13:50
experiences processor
public function launch($experience, $event, $tag)
{
$f3 = \Base::instance();
$this->setTheme($tag);
$array = explode('\\', $experience->controller);
$array=array_filter($array);
{
"_id" : ObjectId("536fe0d413ec02702c8b45d6"),
"name" : "Checkin",
"device_id" : "manualdevice",
"type" : "Checkin",
"controller" : "\\Experiences\\Checkin\\Site\\Controllers\\Controller",
"action" : "launch",
"submit" : "Add",
"event" : {
"id" : ObjectId("5367c5b623195a89b90041a7"),
@ChrisFrench
ChrisFrench / activities.php
Created May 20, 2014 13:20
hacked helper
<?php
namespace Dash\Helpers;
//Convert Activities to Nice humaniness output
Class Activity {
<?php
namespace Dash\Site\Models\Event;
class Tags extends Eventbase
{
/**
* Default Document Structure
* @var unknown
*/
<?php
Class URLGenerator {
var $base = 'ryst.cc/b/';
var $amount = '110000';
//var $group = 'wf-';
var $uuid = 'cccc';
var $filename = 'goband2025';
@ChrisFrench
ChrisFrench / gist:5461452
Created April 25, 2013 17:17
validation.php
<?php
/**
* Verifies that all the required form fields are completed
* if any fail verification, set
* $object->error = true
* $object->message .= '<li>x item failed verification</li>'
*
* @param unknown $submitted_values array post data
* @return unknown_type
@ChrisFrench
ChrisFrench / send.php
Created January 11, 2013 21:10
Sending email with sendgrid
include 'sg/SendGrid_loader.php';
//Getting the elements from the form
//
$guestName = $_REQUEST['guestName'] ;
$accomodationPlans = $_REQUEST['accomodationPlans'] ;
$favoriteLoveSong = $_REQUEST['favoriteLoveSong'] ;
$bestContact = $_REQUEST['bestContact'] ;
$message = $_REQUEST['message'] ;
@ChrisFrench
ChrisFrench / gist:4275209
Created December 13, 2012 09:22
Accessing the Custom Fields in Joomla User Profile
<?php
$user = JFactory::getUser();
$profile = JUserHelper::getProfile($user->id);
var_dump($profile);
//each plugin adds its own object loaded with an array so you can access your fields like this
echo $profile->profile['address1'];
?>
@ChrisFrench
ChrisFrench / customcategorieslist.php
Created November 26, 2012 23:34
How to use Joomla Categories System in a custom Component, and Have custom select list
JTable::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_categories/tables' );
JModel::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_categories/models' );
$model = JModel::getInstance('Categories','CategoriesModel');
$model->setState('list.select','a.id, a.title, a.alias, a.note, a.published, a.params');
$app = JFactory::getApplication();
$app -> setUserState('com_categories.categories.filter.extension', 'com_yourapp.yoursection');
$items = $model -> getItems();