Skip to content

Instantly share code, notes, and snippets.

@lagbox
lagbox / Illuminate\Contracts\View\Shareable.php
Last active September 7, 2020 09:31
ShareLater functionality
<?php
namespace Illuminate\Contracts\View;
interface Shareable
{
/**
* Resolve the shareable data.
*
* @return mixed
<form action="test?test=query" method="post">
@csrf
<input type="hidden" name="test" value="post" />
<input type="submit" value="blah" />
</form>
<?php
Route::get('/{type?}', function ($type = "") {
// if (in_array($type, ['buy', 'sell'])) {
if ($type == 'buy' || $type == 'sell') {
return view('home', [
'country' => app('App\Http\Controllers\CountriesController')->getCountry(),
]);
}
@lagbox
lagbox / Factory.php
Last active August 5, 2018 18:46
view factory share later
<?php
// View/Factory.php
...
public function shareLater($key, callable $value)
{
$keys = is_array($key) ? $key : [$key => $value];
foreach ($keys as $key => $value) {
$this->share($key, new Shareable($this->container, $value));
@lagbox
lagbox / keybase.md
Created November 2, 2017 00:10
keybase.md

Keybase proof

I hereby claim:

  • I am lagbox on github.
  • I am lagbox (https://keybase.io/lagbox) on keybase.
  • I have a public key ASCQteousz2szFfmNleRonMulhl0FvZELkm3q6P85vVBUQo

To claim this, I am signing this object:

@lagbox
lagbox / RouteServiceProvider.php
Last active July 30, 2016 05:48
Laravel >= 5.2.27 Registering API routes separately.
<?php
...
class RouteServiceProvider ...
{
...
public function map(Router $router)
{
@lagbox
lagbox / indent-whole-line.js
Last active May 3, 2016 20:17
Komodo - Indent and Unindent entire line, respecting cursor position and selection
// Macro recorded on: Thu Apr 28 2016 11:27:27 GMT-0400 (EDT)
komodo.assertMacroVersion(3);
if (komodo.view) { komodo.view.setFocus(); }
var editor = require("ko/editor");
// current cursor position
var pos = editor.getCursorPosition();
// current line size
var osize = editor.getLineSize();
<?php
namespace App\Http\Controllers;
use App\Http\Requests\TestRequest;
class TestController extends Controller
{
public function __construct()
{
@lagbox
lagbox / letsdothis.md
Last active April 27, 2016 10:43
Lets Do This

Has moved to my blog

This has been moved to my blog at asklagbox blog

Letsdothis your first quick laravel app

We are going to make a quick laravel application, including the setup and install.

We will setup the project using the following:

  • Nginx
  • sqlite3
@lagbox
lagbox / expires.coffee
Created March 31, 2016 11:55
Expiring Brain Repository
#
# data structure
# {
# key: ...,
# expires_at: ...,
# ...
# }
#
class CacheBrain