Skip to content

Instantly share code, notes, and snippets.

View imacrayon's full-sized avatar

Christian Taylor imacrayon

View GitHub Profile
diff --git a/src/Tags/Glide.php b/src/Tags/Glide.php
--- a/src/Tags/Glide.php
+++ b/src/Tags/Glide.php
@@ -135,7 +135,11 @@
$data = ['url' => $this->generateGlideUrl($item)];
if ($this->isValidExtension($item)) {
- $path = $this->generateImage($item);
+ if (is_string(config('statamic.assets.image_manipulation.cache'))) {
+ $path = Str::removeLeft($data['url'], GlideManager::url().'/');
@imacrayon
imacrayon / AlpineAjax.php
Last active February 11, 2023 18:09
Alpine AJAX Laravel Middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Facade;
@imacrayon
imacrayon / Icon.vue
Created August 25, 2019 19:32
Inline SVG Vue Component
<template>
<svg v-bind="attributes" v-html="html"></svg>
</template>
<script>
export default {
props: ['name'],
data: () => ({
attributes: {},
@imacrayon
imacrayon / table.css
Created August 7, 2019 19:47
Mobile Friendly Table Styles
@media (max-width: 768px) {
.table-collapse {
width: 100%;
& > tfoot,
& > thead {
display: none;
}
& > tbody,
& > tbody > tr,
& > tbody > tr > td,
@imacrayon
imacrayon / Laravel Notification Email
Created June 2, 2019 14:18
View a Laravel notification email in the browser
Route::get('test-notification', function () {
$message = (new \App\Notifications\Notification)->toMail('test@email.com');
$markdown = new \Illuminate\Mail\Markdown(view(), config('mail.markdown'));
return $markdown->render('vendor.notifications.email', $message->toArray());
});
@imacrayon
imacrayon / ReadCSV.php
Last active June 4, 2019 22:09
An "action class" to read CSV data into an associative array
<?php
class ReadCsv
{
private $handler;
public function __destruct()
{
if ($this->handler) {
fclose($this->handler);