Skip to content

Instantly share code, notes, and snippets.

View tristanbailey's full-sized avatar
🏭
Talking to manufacturers

Tristan Bailey tristanbailey

🏭
Talking to manufacturers
View GitHub Profile
@ndiego
ndiego / block-variation-examples
Last active February 28, 2023 19:36
Block Variation Examples
/**
* Add the following to a theme's functions.php file.
*/
function example_enqueue_block_variations() {
wp_enqueue_script(
'frost-enqueue-block-variations',
get_template_directory_uri() . '/assets/js/variations.js',
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' )
);
<?php
/**
* Get array of post ID's with specific meta key and value
*
* @param string $meta_key - The meta key you are checking for
* @param string $meta_value - The meta value for the meta key you're checking for
* @param string $post_type - The post type to use with get_posts() - default: post
*
* @return array
*/
<?php
namespace App\Nova\Filters;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Container\Container;
use Laravel\Nova\Filters\DateFilter as NovaDateFilter;
class DateFilter extends NovaDateFilter
@chrisoverstreet
chrisoverstreet / index.html
Created October 17, 2017 01:09
Infinite Scroll - Masonry
<h1>Infinite Scroll - Masonry image grid</h1>
<div class="grid are-images-unloaded">
<div class="grid__col-sizer"></div>
<div class="grid__gutter-sizer"></div>
<div class="grid__item grid__item--height2"></div>
<div class="grid__item grid__item--width2">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg" alt="orange tree" />
</div>
<div class="grid__item grid__item--height3"></div>
@renebakx
renebakx / uuids.php
Created April 30, 2017 18:06
Laravel 5.4 UUID Trait
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Ramsey\Uuid\Uuid;
trait Uuids {
<script>
import UseModal from './shared/modal/UseModalMixin.js';
export default {
mixins: [UseModal],
};
</script>
<template>
<modal size="md" v-ref:modal>
@BretFisher
BretFisher / docker-xenial-copy-paste.sh
Last active December 1, 2023 01:39
Install Docker PPA on Ubuntu 16.04
# NOT FOR SHELL SCRIPT, but rather just for quick copy paste
# this is a copy-paste version with defaults of the full shell script docker-xenial.sh which is below this one in gist.
apt-get -y install apt-transport-https ca-certificates curl && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && \
apt-get install -y -q docker-ce && \
printf '{ "userns-remap" : "default" , "storage-driver" : "overlay2" }' > /etc/docker/daemon.json && \
@BretFisher
BretFisher / docker-cli-tips-and-tricks.md
Last active December 6, 2023 19:49
Docker CLI Tips and Tricks
@monkeymonk
monkeymonk / pagination.vue
Created July 28, 2016 09:22 — forked from vinicius73/pagination.vue
VueJS Pagination directive
<template>
<ul class="pagination">
<li v-show="current_page != 1">
<a href="javascript:;"
aria-label="Previous"
v-on:click="previousPage()">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<li v-for="page in total_pages"
@kosamari
kosamari / _ServiceWorker_for_github_pages.md
Last active April 1, 2024 05:44
ServiceWorker for github pages.

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.