Skip to content

Instantly share code, notes, and snippets.

@pryley
pryley / GenerateImageKitJob.php
Last active Mar 1, 2021
ImageKit job for the Responsive Images Statamic addon (https://statamic.com/addons/spatie/responsive-images)
View GenerateImageKitJob.php
<?php
namespace App\Jobs;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Spatie\ResponsiveImages\Jobs\GenerateImageJob;
class GenerateImageKitJob extends GenerateImageJob
{
View close-popup.antlers.html
<div x-data="{ show: !localStorage.getItem('hide-popup') }">
<div x-show="show">
<button @click="localStorage.setItem('hide-popup', true); show = false">
close
</button>
</div>
</div>
@pryley
pryley / IsLocalUrl.php
Last active Aug 14, 2020
Add additional attribute to non-local links
View IsLocalUrl.php
<?php
namespace App\Modifiers;
use Illuminate\Support\Str;
use Statamic\Modifiers\Modifier;
class IsLocalUrl extends Modifier
{
/**
@pryley
pryley / _figures.antler.html
Last active Aug 6, 2020
Statamic 3 field for displaying multiple images
View _figures.antler.html
<div class="size-{{ grid_size }} gap-4 grid | md:grid-cols-12 | xl:gap-6">
{{ assets:images }}
<figure class="| md:{{ grid_columns }}">
{{ responsive:url glide:width="1200" :ratio="image_ratio" }}
{{ if alt }}
<figcaption>{{ alt }}</figcaption>
{{ /if }}
</figure>
{{ /assets:images }}
</div>
@pryley
pryley / debug.css
Last active Aug 5, 2020
[tailwindcss] Display screen breakpoints on the local environment
View debug.css
body.debug::before {
@apply .bg-gray-900;
@apply .fixed;
@apply .font-mono;
@apply .leading-none;
@apply .left-0;
@apply .pointer-events-none;
@apply .px-2;
@apply .py-1;
@apply .text-white;
@pryley
pryley / embed-pdf.php
Created Jul 4, 2020
Embed a PDF as a webpage
View embed-pdf.php
<?php
$copyright = 'Copyright 2020, Acme Inc.'; // copyright info of PDF file
$pdfPath = '/document.pdf'; // path to PDF file
$pdfTitle = 'Embedded PDF'; // title of PDF document
?><!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
View ImportFlamingoEntries.php
class ImportFlamingoEntries
{
public $db;
public $form;
public $tags;
public $track;
public $vxcf;
public $imported = 0;
@pryley
pryley / index.html
Last active May 15, 2020
Tailwindcss debug grid #tailwindcss
View index.html
<!DOCTYPE html>
<html class="debug">
<head>
<title></title>
</head>
<body>
<section>
<div class="container">
<div class="bg-red-100 row">
<div class="bg-blue-100 col p-8 | sm:w-1/2"></div>
@pryley
pryley / letsencrypt_2018.md
Created May 2, 2019 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2018.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@pryley
pryley / nativefier-scrumpy.md
Last active Apr 26, 2018
Nativefier customisations for Scrumpy
View nativefier-scrumpy.md

1. Create scrumpy.css

body {
    -webkit-app-region: drag;
}
a,
button,
.grid__item {
    -webkit-app-region: no-drag;
}