Skip to content

Instantly share code, notes, and snippets.

View SketchBookkeeper's full-sized avatar
:octocat:
git status

Paul Allen SketchBookkeeper

:octocat:
git status
View GitHub Profile
// .js-parallax element should have a css bg image.
const parallaxItems = Array.from(document.querySelectorAll('.js-parallax'));
function runParallax() {
parallaxItems.forEach(item => {
const rect = item.getBoundingClientRect();
const offset = ((rect.top / rect.height) * 100) * 0.25;
item.style.backgroundPosition = `50% ${offset}%`
@SketchBookkeeper
SketchBookkeeper / stop-video.js
Created March 19, 2019 15:37 — forked from cferdinandi/stop-video.js
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
// Posts and Tags have the "many to many" relation.
$arrayOfTags = [1,2,5];
$posts = Post::whereHas('tags', function($q) {
$q->whereIn('tags.id', $arrayOfTags);
} )->get();
DB::enableQueryLog();
// then to view the queries...
DB::getQueryLog();
@SketchBookkeeper
SketchBookkeeper / Guide.md
Last active March 8, 2019 15:50
I tried going off both these guides but they did not work. Still good resources though. https://www.youtube.com/watch?v=AomK1eYAq78&list=PLUBR53Dw-Ef-X-_A1KLy41r2QArCBy4rM&index=23 https://vimeo.com/108040919

Extending the User Plugin

1 | Make a plugin php artisan create:plugin PaulAllen.profile

2 | In the udates folder, edit the database migration file. In this example it's create_profiles_table.php. We'll use this to add a column to the users table. I'm keeping this simple but in production you may want to make sure the users table actually exists. Here we are just adding a "bio" column.

<?php namespace PaulAllen\Profile\Updates;

use Schema;

In your .test. For me this was located in myuser/.config/valet/Nginx

server {
		location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp)$ {
        try_files $uri @image_fallback;
    }

    location @image_fallback {
 proxy_pass http://;
-ms-overflow-style: none;
@SketchBookkeeper
SketchBookkeeper / functions.php
Created February 21, 2019 18:10
Hide Product Category Count in WooCommerce. If you want to hide product category count on the shop page, you only need to add this code to the bottom of your child theme’s functions.php file.
// Hide Product Category Count
add_filter( 'woocommerce_subcategory_count_html', 'prima_hide_subcategory_count' );
function prima_hide_subcategory_count() {
/* empty - no count */
}
@SketchBookkeeper
SketchBookkeeper / .eslintignore
Created February 5, 2019 20:19 — forked from ahmadawais/.eslintignore
WP: Gutenberg ESLint
**/*.min.js
**/node_modules/**
**/vendor/**
build
coverage
cypress
node_modules
vendor
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* Code */
}