Skip to content

Instantly share code, notes, and snippets.

pryley / debounce.ts
Created Sep 23, 2021
Debounce function
View debounce.ts
export function Debounce (fn: Function, wait = 200) {
let timerId: number
let lastArgs: Array<any> | undefined
let lastCallTime: DOMHighResTimeStamp
let lastThis
let result
const startTimer = (pendingFunc: FrameRequestCallback) => {
return requestAnimationFrame(pendingFunc)
pryley / breakpoints.js
Last active Sep 12, 2021
tiny-swiper plugin for breakpoints
View breakpoints.js
import { SwiperInstance, SwiperPlugin } from '../core/index'
import { Options } from '../core/options'
export default <SwiperPlugin>function SwiperPluginBreakpoints (
instance: SwiperInstance,
options: Options,
) {
const isEnabled = Boolean(options.breakpoints)
if (!isEnabled) return
pryley / GenerateImageKitJob.php
Last active Mar 1, 2021
ImageKit job for the Responsive Images Statamic addon (
View GenerateImageKitJob.php
namespace App\Jobs;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Spatie\ResponsiveImages\Jobs\GenerateImageJob;
class GenerateImageKitJob extends GenerateImageJob
pryley / UltimateMembersMods
Created May 4, 2015
This Wordpress plugin adds custom features and modifications to the Ultimate Member plugin family.
View UltimateMembersMods
* Plugin Name: Ultimate Member Modifications
* Plugin URI:
* Description: This plugin adds custom features and modifications to the Ultimate Member plugin family.
* Version: 1.0.0
* Author: Gemini Labs
* Author URI:
* License: MIT License
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">
pryley / IsLocalUrl.php
Last active Aug 14, 2020
Add additional attribute to non-local links
View IsLocalUrl.php
namespace App\Modifiers;
use Illuminate\Support\Str;
use Statamic\Modifiers\Modifier;
class IsLocalUrl extends Modifier
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 }}
{{ /assets:images }}
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 / embed-pdf.php
Created Jul 4, 2020
Embed a PDF as a webpage
View embed-pdf.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">
<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;