Skip to content

Instantly share code, notes, and snippets.

View radermacher's full-sized avatar

Richard Radermacher radermacher

View GitHub Profile
@radermacher
radermacher / ExternalLink.php
Last active July 28, 2023 14:13
NativePHP External Link Livewire Component #nativephp #livewire
@radermacher
radermacher / boost.js
Last active August 28, 2023 10:55 — forked from b-nnett/boost.js
Arc ChatGPT Boost
// fork of https://gist.github.com/b-nnett/2749adb44566239e4c85ad1a8937c2bc
// origin by @B_nnett → https://twitter.com/joshm/status/1648346253355282432?s=20
/*
To set up this boost for chat.openai.com:
1) open Arc browser and login at chat.openai.com.
2) Head over to the + button in your sidebar and select New Boost.
Or hit ⌘ + T and type New Boost into your Command Bar.
3) Click the `Code` button.
<?php
namespace App\Traits;
use Carbon\Carbon;
trait FilterableByDates
{
public function scopeToday($query, $column = 'created_at')
{
@radermacher
radermacher / SwapOctaneServer.php
Created August 24, 2022 09:22 — forked from pascalbaljet/SwapOctaneServer.php
Blue-green deployment with Laravel Octane
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Concerns\CallsCommands;
use Illuminate\Support\Facades\Http;
use Laravel\Forge\Forge;
use Laravel\Forge\Resources\Daemon;
<?php
$url = "https://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2?callback=Request.JSONP.request_map.request_0";
$content = file_get_contents($url);
$content = substr($content, strlen("Request.JSONP.request_map.request_0("));
$content = substr($content, 0, strlen($content) - 2);
$content = json_decode($content);
@radermacher
radermacher / hnl.mobileConsole.js
Created June 21, 2018 11:56 — forked from c-kick/hnl.mobileConsole.js
hnl.mobileConsole.js - extends JavaScript's console to display a visual console inside the webpage. Very usefull for debugging JS on mobile devices with no real console. Info and demo: http://www.hnldesign.nl/work/code/mobileconsole-javascript-console-for-mobile-devices/
/*!
* hnl.mobileConsole - javascript mobile console - v1.2.6 - 26/10/2016
* Adds html console to webpage. Especially useful for debugging JS on mobile devices.
* Supports 'log', 'trace', 'info', 'warn', 'error', 'group', 'groupEnd', 'table', 'assert', 'clear'
* Inspired by code by jakub fiala (https://gist.github.com/jakubfiala/8fe3461ab6508f46003d)
* Licensed under the MIT license
*
* Original author: @hnldesign
* Further changes, comments: @hnldesign
* Copyright (c) 2014-2016 HN Leussink
/**
* @author Siv.S
* @date 03/may/2014 at 11:32
*
* convertImgToBase64
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat='image/png']
* @author HaNdTriX
* @example
@radermacher
radermacher / ThemosisValetDriver.php
Created February 8, 2017 14:12 — forked from ramon-villain/ThemosisValetDriver.php
Themosis 1.3 Valet Driver
<?php
class ThemosisValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@radermacher
radermacher / AppServiceProvider.php
Created January 20, 2017 14:20 — forked from lukepolo/AppServiceProvider.php
Laravel Scout Engine for Elasticsearch
// inside boot()
resolve(EngineManager::class)->extend('elasticsearch', function () {
return new ElasticsearchEngine(ClientBuilder::fromConfig(config('scout.elasticsearch.config')), config('scout.elasticsearch.index'));
});