This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Livewire; | |
use App\Livewire\Attributes\DontTrim; | |
use App\Livewire\Attributes\Trim; | |
trait HandlesStringTrimming | |
{ | |
public bool $trimsAllStrings = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ray, Ray} from "node-ray/web"; | |
const colors = ['green', 'orange', 'red', 'purple', 'blue', 'gray']; | |
const componentMap = new Map(); | |
let colorIndex = 0; | |
const Payload = class { | |
constructor() { | |
this.remotePath = null; | |
this.localPath = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrayToCsv(array $data) { | |
retun collect($data) // turn into collection | |
->map(fn ($i) => collect($i)) // turn next layer into collection | |
->pipe(fn ($c) => $c->prepend($c->first()->keys())->map->values()) //grab keys from firt item in the array and prepend them and return only the array values | |
->pipe(function($c){ // format fields for CSV: escape " with another ", wrap fields with new lines, commas, and double quotes with a quote | |
return $c->map->map(function($i){ | |
if(Str::contains($i,'"')) { | |
return '"'.str_replace('"', '""', $i).'"'; | |
} elseif (Str::contains($i,[',',"\n"])){ | |
return '"'.$i.'"'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener('alpine:init', () => { | |
Alpine.data('flatpickr', () => ({ | |
selectedDate: '', | |
init() { | |
const fp = new window.flatpickr(this.$refs.picker, {}); | |
if (typeof window.flatpickrInputs === 'undefined') { | |
window.flatpickrInputs = []; | |
} | |
window.flatpickrInputs.push(fp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>List</h1> | |
<ul | |
x-data="{items: @entangle('items').defer, newItem:'', errors:{}}" | |
@validation.window="errors = $event.detail"> | |
<template x-for="(item, index) in items"> | |
<li x-bind:class="errors['item.'+index'] ? 'text-danger' : ''"> | |
<span x-text="item"></span> | |
<i x-show="errors['item.'+index']" | |
x-text="errors['item.'+index] ? errors['item.'+index].join(' ') : ''" | |
> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alpineLoaded = false; | |
let livewireLoaded = false; | |
document.addEventListener('alpine:init', () => { | |
alpineLoaded = true; | |
setupLivewireErrorListener(); | |
}); | |
document.addEventListener('livewire:load', () => { | |
livewireLoaded = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div x-data="googlePlacesAutocomplete" class="grid grid-cols-3 gap-2"> | |
<input type="text" x-model="address.address1" x-ref="googleAutocomplete" autocomplete="chrome-off" class="col-span-3 sm:col-span-2 order-1" placeholder="Add‌ress"> | |
<input type="text" x-model="address.address2" placeholder="Apt/Ste" class="col-span-3 sm:col-span-1 order-2"> | |
<input type="text" x-model="address.city" placeholder="Ci‌ty" class="col-span-1" x-bind:class="`order-${order.locality}`"> | |
<select x-model="address.state" placeholder="State" class="col-span-1 order-4" x-show="isUSA"> | |
<option value="">State</option> | |
<option value="AL">Alabama</option> | |
<option value="AK">Alaska</option> | |
<option value="AZ">Arizona</option> | |
<option value="AR">Arkansas</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(angular){ | |
angular | |
.module('tm-directives') | |
.directive('tmExcelImport',tmExcelImport); | |
tmExcelImport.$inject=['$timeout']; | |
function tmExcelImport($timeout){ | |
var directive = { | |
scope:{ | |
callback:'&tmExcelCallback' |