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>
public function findSimilarInCategories($categories, $ignore_id)
{
$query = $this->createQuery();
// $catUids = [];
// foreach ($categories as $category) {
// $catUids[] = $category->getUid();
// }
$response = Http::withHeaders([
"X-Auth-Token" => config('services.getresponse.api_key')
])->post('https://api.getresponse.com/v3/contacts', [
"name" => $user->name,
"email" => $user->email,
"campaign" => [
"campaignId" => config('services.getresponse.list_token')
]
]);
@MrMooky
MrMooky / gist:89807c9d7d3eabf12f4a1aa2effd7abe
Created April 23, 2021 08:21
jQuery Hide container when clicking outside
$(document).mouseup(function(e){
var container = $('.topbar .box:visible');
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.slideUp(150);
}
});
<input type='tel' data-filter='[0-9|+]*' placeholder='123+456'>
<input type='tel' data-filter='(\+|(\+[1-9])?[0-9]*)' placeholder='+10123'>
<input type='text' data-filter='([A-Z]?|[A-Z][a-z]*)' placeholder='Abcdefg'>
<input type='text' data-filter='([A-Z]{0,3}|[A-Z]{3}[0-9]*)' placeholder='ABC123'>
---
// Apply filter to all inputs with data-filter:
let inputs = document.querySelectorAll('input[data-filter]');
COMPOSER_MEMORY_LIMIT=-1 composer require author/package
$update = \Stripe\Subscription::update($subscriptionId, [
'billing_cycle_anchor' => 'now',
'proration_behavior' => 'always_invoice',
'proration_date' => strtotime('tomorrow 00:01'),
'default_tax_rates' => [$this->getCorrectTaxRateId($planID)],
'cancel_at_period_end' => false,
'items' => [
[
'id' => $subscription->items->data[0]->id,
'plan' => $planID
> location.main
v1
location /blog/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2371;
> Usage
$recipient = array('recipient@domain.tld');
$sender = array('sender@domain.tld' => 'Account');
$subject = 'Hello there';
$templateName = "ThisIsTheExtbaseEmailTemplate"; // .html file
$content = array(
'firstname' => $postData['first_name']
);