Skip to content

Instantly share code, notes, and snippets.

View Teevio's full-sized avatar
🎙️
Something is coming...

Stephen Hallgren Teevio

🎙️
Something is coming...
View GitHub Profile
<?php
function getService()
{
// Creates and returns the Analytics service object.
// Load the Google API PHP Client Library.
require_once 'google-api-php-client/src/Google/autoload.php';
// Create and configure a new client object.
// If you don't care about IE
jsConfig.pageData = Object.assign({}, jsConfig.pageData, { [path]: data.page })
// If you use Underscore.js
jsConfig.pageData = _.extend(jsConfig.pageData, { [path]: data.page });
// If you use jQuery
jsConfig.pageData = jQuery.extend(true, jsConfig.pageData, { [path]: data.page });
// Just JS
<?php
namespace App;
use App\Model;
class User extends Model
{
}
<?php
// File saved to app/Model.php
namespace App;
use Illuminate\Database\Eloquent\Model as BaseModel;
use App\Database\Query\Builder as QueryBuilder;
class Model extends BaseModel
{
<?php
// Unique key for the cache
$cacheKey = 'a-key-that-you-decide';
$fan = Fan::find(1);
$fan->save([
'first_name' => 'Stephen'
]);
@Teevio
Teevio / manual-caching.php
Last active October 15, 2015 18:01
Manual Caching
<?php
// Unique key for the cache
$cacheKey = 'a-key-that-you-decide';
$fan = Cache::get($cacheKey);
// If the cache doesn't exist get data and cache
if (is_null($fan)) {
$fan = Fan::find(1);
$expires = 84000;