Skip to content

Instantly share code, notes, and snippets.

View gjhead's full-sized avatar
💭
huh?

G. Jason Head gjhead

💭
huh?
View GitHub Profile
@todbot
todbot / lumon_screensaver.py
Created April 5, 2022 21:33
Lumon screen saver from Severance, in CircuitPython
# Lumon screen saver from Severance
# 5 Apr 2022 - @todbot / Tod Kurt, from @jedgarpark suggestion
import time
import board
import displayio
logo_fname = "/lumon_logo_100x52.bmp"
logo_w = 100
logo_h = 52
@Nooshu
Nooshu / iphone-versions.txt
Created June 18, 2021 08:16
Extracting iPhone versions from GA using DataStudio. Create a new field, use it as the breakdown dimension.
CASE
when Screen Resolution IN ("320x480") THEN "iPhone 1-4"
when Screen Resolution IN ("320x568") THEN "iPhone 5, SE, 5C, 5S"
when Screen Resolution IN ("375x667") THEN "iPhone 6, 6S, 7, 8, SE 2020"
when Screen Resolution IN ("414x736") THEN "iPhone 6+, 6S+, 7+, 8+"
when Screen Resolution IN ("375x812") THEN "iPhone X, XS, 11 Pro"
when Screen Resolution IN ("414x896") THEN "iPhone 11, XR, XS Max, 11 Pro Max"
when Screen Resolution IN ("390x844") THEN "iPhone 12, 12 Pro"
when Screen Resolution IN ("360x780") THEN "iPhone 12 Mini"
when Screen Resolution IN ("428x926") THEN "iPhone 12 Pro Max"

How I Update Craft CMS 3.5.x and Craft CMS Plugins

⏳ 2 min read.

Update apnea: the temporary cessation of breath when updating Craft and Craft plugins.

This article describes the steps I follow to update Craft 3.5.x and plugins in a stress-free and reliable manner. 🧘

Photo of blue and pink sea by Harli Marten Photo by Harli Marten on Unsplash

@yehgdotnet
yehgdotnet / install_phpzip.md
Last active February 7, 2023 13:14
MAMP PRO for Mac OSX - Installing PHP ZIP extension

From Terminal

# install dependencies
brew install autoconf # required by pecl 
brew install libzip


# install zip extenion in your selected MAMP PHP version 
ls /Applications/MAMP/bin/php/
<?php
add_filter( 'acf/fields/wysiwyg/toolbars', function ( $toolbars ) {
// Register a basic toolbar with a single row of options
$toolbars['Custom One'][1] = [ 'bold', 'italic', 'underline', 'forecolor', 'link', 'unlink' ];
// Register another toolbar, this time with two rows of options.
$toolbars['Custom Two'][1] = [ 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'wp_adv' ];
$toolbars['Custom Two'][2] = [ 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright' ];
@juban
juban / index.twig
Last active April 3, 2024 09:26
Paginate any array within Craft CMS 3 templates
{% set someArrayToPaginate = [
{someProperty:"One"},
{someProperty:"Two"},
{someProperty:"Three"},
{someProperty:"Four"},
{someProperty:"Five"},
{someProperty:"Six"},
{someProperty:"Seven"},
{someProperty:"Eight"},
{someProperty:"Nine"},
import collections
import math
import os
import cv2
import numpy as np
import time
MAX_LINES = 4000
N_PINS = 36*8
MIN_LOOP = 20 # To avoid getting stuck in a loop
@8ctopotamus
8ctopotamus / count-repeater-fields-in-acf-flexible-content-example.php
Last active February 23, 2024 20:58
Count number of repeater fields in ACF flexible content.
// Source: https://katienelson.co.uk/developer-acf-counting-repeater-rows-inside-flexible-content/
// The following code doesn’t work with a repeater field if it is part of a flexible content block.
<?php
if(have_rows('card')):
$cards = get_sub_field('card');
$number_of_cards = count($cards);
endif;
?>
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");