Skip to content

Instantly share code, notes, and snippets.

{
"core":{
"id":"string",
"active":"bool",
"first_name":"string",
"last_name":"string",
"email":"string",
"phone_number":"string",
"date_created":"timestamp",
"affinity_number":"int",
@sameg14
sameg14 / final_upm_esp_attributes.json
Last active February 19, 2016 22:18
Final UPM ESP attributes
{
"core":{
"id":"string",
"active":"bool",
"first_name":"string",
"last_name":"string",
"email":"string",
"phone_number":"string",
"date_created":"timestamp",
"affinity_number":"int",
[{"ID":{"value":"001L000000gNLRWIA4"},"LastName":{"value":"testing"},"FirstName":{"value":"qa"},"PersonHasOptedOutOfEmail":{"value":"1"},"CustomerMainStore__c":{"value":""},"CustomerStatus__c":{"value":"Active"},"Gender__c":{"value":"Not Saying"},"GlutenFree__c":{"value":"0"},"MainStore__c":{"value":""},"OptOutCommunication__c":{"value":"0"},"PersonAccountEmail__c":{"value":"[email protected]"},"PointsBalance__c":{"value":"50.0"},"Vegan__c":{"value":"0"},"HouseholdSize__c":{"value":"3"},"MemberID__c":{"value":"48001321142"},"TotalLifetimeSpend__c":{"value":""},"Affinity_Rewards_Program__c":{"value":"1"},"Wholebody_Program__c":{"value":"1"},"Wholebody_Tier__c":{"value":""},"ServiceCloud__c":{"value":"0"},"TotalPointsEarned__c":{"value":""},"WBRegion__c":{"value":""},"TotalPointsUsed__c":{"value":""},"TotalTransactions__c":{"value":""},"JanrainUUID__c":{"value":"b066363b-4f3e-41bc-8e17-f6cc045976fa"},"DigitalCouponMember__c":{"value":"1"},"ImyFamilyDoNotEatDairy__c":{"value":"0"},"ImyFamilyDoNotEatSeafood__
[
{
"offer_type":"punch",
"title":"Buy 5 ice cream, get 1 50% off.",
"sub_title":"Ice Cream",
"rewards_sync_timestamp":null,
"require_offer_claim":false,
"rank":null,
"punches_per_card":​5,
"offer_tcs":"Buy 5 ice cream, get 1 50% off.",
@sameg14
sameg14 / ansible_deploy.yml
Created April 29, 2016 19:58
Ansible playbook to deploy
---
- name: Update code
sudo: yes
sudo_user: ubuntu
git: repo=ssh://[email protected]/sameg14/tib.git
dest=/var/www/tib
version=master
accept_hostkey=True
force=True
@sameg14
sameg14 / service_container.yml
Created April 29, 2016 20:00
Service container in symfony (inversion of control)
services:
app.request_listener:
class: Tib\CoreBundle\EventListener\RequestListener
arguments: [@db2, @session, @service.job_scheduler]
tags:
- { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
client.guzzle:
class: GuzzleHttp\Client
@sameg14
sameg14 / CollectUserStatsWorker.php
Created April 29, 2016 20:01
An example of a worker written in PHP that collects user statistics
<?php
namespace Tib\CoreBundle\Job\Worker;
use Tib\CoreBundle\Exception\APIException;
use Tib\CoreBundle\Exception\InvalidDataException;
use Tib\CoreBundle\Util\JsonResponseTrait;
/**
* Class CollectUserStatsWorker collects user information and records it to a table
@sameg14
sameg14 / S3Service.php
Created April 29, 2016 20:03
An example service that contains business logic
<?php
namespace Tib\CoreBundle\Service;
use Aws\S3\S3Client;
use Tib\CoreBundle\Model\User;
use Aws\S3\Iterator\ListObjectsIterator;
use Tib\CoreBundle\Exception\UploadException;
use Aws\Common\Credentials\CredentialsInterface;
use Tib\CoreBundle\Exception\InvalidDataException;
<?php
namespace Tib\CoreBundle\Service;
use Tib\CoreBundle\Db\DBCommon;
use Tib\CoreBundle\Model\Mix;
use Tib\CoreBundle\Model\User;
use Tib\CoreBundle\Model\MixComment;
@sameg14
sameg14 / JobScheduler.php
Created April 29, 2016 20:14
Schedule jobs
<?php
namespace Tib\CoreBundle\Job\Scheduler;
use \Resque;
use \Resque_Worker;
use \Resque_Job_Status;
use Tib\CoreBundle\Job\Data\Broker as DataBroker;
use Symfony\Component\DependencyInjection\ContainerInterface;