Skip to content

Instantly share code, notes, and snippets.

View jackabox's full-sized avatar
🛠️
Available for Hire

Jack Whiting jackabox

🛠️
Available for Hire
View GitHub Profile
@jackabox
jackabox / parser.js
Last active March 1, 2024 05:35
Example of Node / JSONStream / Event-stream parser
import hyperquest from 'hyperquest'
import JSONStream from 'JSONStream'
import es from 'event-stream'
import { format } from 'date-fns'
const scraper = async () => {
const scryfallJSONUrl =
'https://archive.scryfall.com/json/scryfall-default-cards.json'
await hyperquest(scryfallJSONUrl)
@jackabox
jackabox / modal.html
Last active October 23, 2023 03:54
Creating a modal with Alpine JS + Tailwind CSS
<div x-data="{ 'showModal': false }" @keydown.escape="showModal = false">
<!-- Trigger for Modal -->
<button type="button" @click="showModal = true">Open Modal</button>
<!-- Modal -->
<div
class="fixed inset-0 z-30 flex items-center justify-center overflow-auto bg-black bg-opacity-50"
x-show="showModal"
>
<!-- Modal inner -->
@jackabox
jackabox / WPGeoQuery.md
Last active September 8, 2023 08:07
WordPress Geo Location Query

WP Geo Query

Quick and easy class created to modify the WP_Query on specific calls and pull in all posts within a radius from a given latitude and longitude.

@jackabox
jackabox / filter.md
Created May 14, 2015 11:14
Filtering custom post types by an ACF field.

Filtering posts via an ACF field.

  • Define the acf key
  • grab the choices
  • create a select with choices
  • request on the meta key/meta value
@jackabox
jackabox / ProgressBar.vue
Last active March 20, 2023 18:50
Vue/Nuxt window on scroll event
<template>
<div class="progress-bar">
<div class="filled-bar" :style="{ transform: `translate3d(-${100-value}%, 0, 0)` }"></div>
</div>
</template>
<script>
export default {
props: ['value']
}
html {
scroll-behavior: smooth;
}
:target:before {
content: "";
display: block;
height: 100px;
margin: -100px 0 0;
}
@jackabox
jackabox / header.html
Last active December 20, 2022 15:36
Alpine Js + Header/Nav basic template with motion safe animation in.
<header
x-data="header()"
class="fixed top-0 left-0 right-0 bg-black z-30"
@scroll.window="hasScrolled = window.scrollY > 260"
>
<!-- Logo to go here -->
<!-- Navigation El -->
<nav
@jackabox
jackabox / AutoComplete.php
Last active November 8, 2022 11:10
Livewire Autocomplete Component
<?php
namespace App\Http\Livewire;
use App\Models\Account;
use Livewire\Component;
class AccountAutocomplete extends Component
{
public $query= '';
@jackabox
jackabox / handyWooFunctions.md
Last active August 17, 2022 19:23
Handy Snippets for WooCommerce

Handy Functions for Manipulating WooCommerce

So far the following areas are covered in this gist:

  • Removing tabs on the product page.
  • Cleaning the WooCommerce loading of scripts/styles on pages with no woo elements.
  • Changing the call order of features on the single product.
  • Removing all WooCommerce called styles.
  • Ajaxifying the cart add
@jackabox
jackabox / .bash_profile
Last active February 4, 2022 11:03
Install script for new mac setup
# PHP Switcher
phpv() {
valet stop
brew unlink php@5.6 php@7.0 php@7.1 php@7.2 php
brew link --force --overwrite $1
brew services start $1
composer global update
valet install
}