Skip to content

Instantly share code, notes, and snippets.

@MrMooky
MrMooky / AppServiceProvider.php
Last active February 17, 2023 07:58 — forked from jacksleight/AppServiceProvider.php
Convert legacy Bard Text Align mark values to Tiptap 2 text align values
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
@MrMooky
MrMooky / editor.blade.php
Created December 21, 2022 08:31 — forked from robertdrakedennis/editor.blade.php
Alpine tiptap editor + livewire
<div x-data="setupEditor(@entangle($attributes->wire('model')).defer)" x-init="() => init($refs.editor)" wire:ignore
{{ $attributes->whereDoesntStartWith('wire:model')->merge(['class' => 'editor !w-full !max-w-full']) }}>
<template x-if="editor">
<div class="flex space-x-4 items-center dark:text-neutral-100 fill-current py-2">
<button @click.prevent="Alpine.raw(editor).chain().toggleBold().focus().run()">
<x-icon-bold class="w-4 h-4" />
</button>
<button @click.prevent="Alpine.raw(editor).chain().toggleItalic().focus().run()">
<x-icon-italic class="w-4 h-4" />
</button>
@MrMooky
MrMooky / AppServiceProvider.php
Created June 13, 2020 15:42 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@MrMooky
MrMooky / slick-random.js
Created February 28, 2020 11:18 — forked from zexeder/slick-random.js
Slick Random Slides
$.fn.randomize = function (selector) {
var $elems = selector ? $(this).find(selector) : $(this).children(),
$parents = $elems.parent();
$parents.each(function () {
$(this).children(selector).sort(function (childA, childB) {
// * Prevent last slide from being reordered
if($(childB).index() !== $(this).children(selector).length - 1) {
return Math.round(Math.random()) - 0.5;
}
@MrMooky
MrMooky / .htaccess
Created August 22, 2019 06:51 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
@MrMooky
MrMooky / FluidContent - Current year
Last active September 6, 2016 10:02 — forked from sauttefk/gist:65071cd1d60f0e42d646
Output current year in Copyright line
&copy; <f:format.date format="Y">{v:system.timestamp()}</f:format.date>