Skip to content

Instantly share code, notes, and snippets.

View Casperhr's full-sized avatar

Casper Rasmussen Casperhr

View GitHub Profile
const STATUSES = [
'NEW' => RiideStates::STATE_REQUESTED, //The booking was created
'SCHEDULED' => RiideStates::STATE_REQUESTED, //The booking was created as prebooking
'ASSIGN' => RiideStates::STATE_REQUESTED, // The booking was assigned to a driver
'BACKTOBASE' => RiideStates::STATE_REQUESTED, // Booking was sent back to the dispatch
'PAUSE' => RiideStates::STATE_ACCEPTED, // The booking is paused.
'PAUSED' => RiideStates::STATE_ACCEPTED, // The booking is paused.,
'ARRIVED' => RiideStates::STATE_ARRIVED, // Driver arrived at pickup location
'NOSHOW' => RiideStates::STATE_NO_SHOW, // The passenger did not show up.
'ENROUTE' => RiideStates::STATE_EN_ROUTE, // Driver is driving to the pickup
<?php
namespace Budget\Models\Project\Item;
use Budget\Models\Project\Item\Allocation\Allocation;
use Budget\Models\Project\Project;
use Nodes\Database\Repository as NodesRepository;
use Nodes\Exception\Exception;
/**
* Class ItemRepository
// determine notification type
if ($this->request->data['Message']['send_as_push'] == false) {
// Mark push notification as sent if msg should not be pushed
$this->request->data['Message']['is_push_send'] = true;
} else {
$this->request->data['Message']['is_push_send'] = false;
}
foreach ($recepients as $r) {
$this->request->data['Message']['reciever_user_id'] = $r['FrontendUser']['id'];
<?php
namespace Puzz\Core;
use Illuminate\Support\Facades\Cache;
use Nodes\Exception\Exception;
/**
* Class CacheHelper
* @author cr@nodes.dk
public function getAllForAPI()
{
// Lets try to look up in cache, hopefuly there is something there
$contacts = Cache::get('contacts')
// Is there something?
if(!empty($contacts) {
// Yep, lucky us, let's just return that instead of wasting time in DB
return $contacts;
}
public function __call($method, $arg) {
if(substr($method, 0, strlen('enqueue')) === 'enqueue') {
$method = str_replace('enqueue', '', $method);
if(method_exists($this, $method)) {
\Queue::push(new NodesCommand([
'class' => get_class($this),
'function' => $method,
'params' => $arg
]));
@Casperhr
Casperhr / gist:8c6903cfcec208dc46f6
Created June 12, 2015 11:14
Country codes.json
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "AndorrA", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "AndorrA", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
public function test1() {
$this->FrontendUser->find('all',[
'limit' => 1000,
]);
$this->respond(200, true);
}
public function test2() {
$this->FrontendUser->find('all',[
if (!empty($this->request->query['search'])) {
$conditions = array_merge($conditions, array($this->Listing->getSearchConditions($this->request->query['search'])));
}
switch ($this->request->query('searchState')) {
case 'archived':
$conditions = array_merge($conditions, array($this->Listing->getArchivedConditions($expireTime)));
break;
case 'all':
break;