Skip to content

Instantly share code, notes, and snippets.

View nowendwell's full-sized avatar

Ben Miller nowendwell

  • Sacramento, CA
View GitHub Profile
@nowendwell
nowendwell / toast.blade.php
Created January 27, 2023 18:25
Alpine Toast - Bootstrap
<div aria-live="polite" aria-atomic="true" x-data="{
toasts: [],
remove(id) {
{{-- this.toasts.splice(this.toasts.indexOf(toast), 1) --}}
this.toasts = this.toasts.filter(t => t.id !== id)
},
listen() {
let toast = event.detail;
let toast_id = (Math.random() + 1).toString(36).substring(7);
this.toasts.push({
@nowendwell
nowendwell / Calendar.php
Last active November 17, 2024 00:25
Laravel Livewire FullCalendar
<?php
namespace App\Http\Livewire;
use App\Models\Event;
use Livewire\Component;
use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
@nowendwell
nowendwell / Go Live.md
Last active August 25, 2020 18:12
Website Go Live Checklist

A checklist for all projects that are going live

This checklist is used whenever a project is going live at https://spatie.be

1. Browserstack tests

  • Desktop: test on latest versions of Chrome, IE/Edge, Firefox, Safari
  • Mobile: test on latest versions of Mobile Safari, Android

2. Front end checklist

@nowendwell
nowendwell / install.sh
Created June 26, 2018 22:29
Install wkhtmltopdf
cd ~
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
cp wkhtmltox/bin/wk* /usr/local/bin/
#And you can confirm with:
#wkhtmltopdf --version
@nowendwell
nowendwell / Helpers.php
Last active July 25, 2023 15:23
Laravel Helpers
<?php
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Storage;
/**
* Format phone number to standard US
*
* @param string $data 9161234567
* @return string (916) 123-4567
*/
@nowendwell
nowendwell / setup.sh
Last active January 18, 2018 03:58
New Computer Setup (macOS)
#!/usr/bin/env bash
# Composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
# Homebrew
<?php
/**
* Modification of "Build a tree from a flat array in PHP"
*
* Authors: @DSkinner, @ImmortalFirefly and @SteveEdson
*
* @link http://stackoverflow.com/a/28429487/2078474
*/
function buildTree( array &$elements, $parentId = 0 )
{
@nowendwell
nowendwell / PHPtoICS.php
Last active December 7, 2016 23:12 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
function make_ics( $summary = 'test', $datestart = 1481328000, $dateend = '', $address = null, $uri = 'http://google.com', $description = 'Here is some body', $filename = 'event.ics' )
{
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)