Skip to content

Instantly share code, notes, and snippets.

@leMaur
leMaur / KeyedSession.php
Created July 18, 2023 09:32 — forked from juampi92/KeyedSession.php
KeyedSession
<?php
namespace App\Support;
use Illuminate\Session\Store;
use RuntimeException;
/**
* Helper class that transforms all sessions into a specific key.
*
<?php
function memoize($target) {
static $memo = new WeakMap;
return new class ($target, $memo) {
function __construct(
protected $target,
protected &$memo,
) {}
<?php
namespace {{ factoryNamespace }};
use Illuminate\Database\Eloquent\Factories\Factory;
use {{ namespacedModel }};
/**
* @method {{ model }}|\Illuminate\Support\Collection<{{ model }}> create($attributes = [], ?Model $parent = null)
* @method \Illuminate\Support\Collection<{{ model }}> createMany(iterable $records)
@leMaur
leMaur / API.md
Created September 19, 2017 12:58 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

function logTimes(message) {
performance.mark(message); // this one is for WebPageTest
console.timeStamp(message); // this is for the Performance tab in Chrome DevTools
console.info(message, performance.now()); // this is for the console, duh
// this here is for Google Analytics
ga('send', {
hitType: 'timing',
timingCategory: 'Performance',
timingVar: message,