Skip to content

Instantly share code, notes, and snippets.

View Jetroid's full-sized avatar
🏴

Jet Holt Jetroid

🏴
View GitHub Profile
var tooltipTimer;
var tooltipDiv;
var tooltip;
var tooltipIn = function(e){
tooltip = e.target;
tooltipTimer = setTimeout(function(){
var position = e.target.getBoundingClientRect();
tooltip.classList.add("show");
}, 200);
}
@Jetroid
Jetroid / product-lifecycle.php
Last active December 20, 2019 07:59
A snippet of code for use with WooCommerce and Advanced Custom Fields to make a product discontinued or forthcoming.
<?php
function is_released($id) {
$status = get_field('product_status', $id);
// We consider null to be for sale, as this indicates an old product
// where we haven't made a selection yet
if (is_null($status) || $status === "forsale") {
return True;
} else if ($status === "forthcoming") {
import yaml
import os
import git
import subprocess
YAML_FILE = "processed.md"
FOLDERS = {
"assets/images/backgrounds/":[1920,1600,1366,1024,768,640],
"assets/images/content/":[1230,1024,874,655,560],
"assets/images/":[] #Do not make any additional sizes
{%- assign pieces = content | split: '<img src="' -%}
{%- for piece in pieces -%}
{%- if forloop.first == true -%}
{{ piece }}
{%- else -%}
{%- if piece contains '" alt="' -%}
{%- assign url = piece | split: '" alt="' | first -%}
{%- assign alt = piece | split: '" alt="' | shift | join: '" alt="' | split: '"' | first -%}
{%- assign rest = piece | split: '" alt="' | shift | join: '" alt="' | split: '"' | shift | join: '"' -%}
{%- assign url-filename = url | split: '.' | pop | join: '.' -%}
import yaml
import os
import git
YAML_FILE = "gallery.md"
FOLDERS = ["_tattoos","_brows","_commission"]
#Link git with python
repo = git.Repo()
#Get the staged files
import yaml
import os
import git
YAML_FILE = "compressed.md"
FOLDERS = ["assets/images/"]
#Link git with python
repo = git.Repo()
#Get the staged files
@Jetroid
Jetroid / custom_stylesheets.html
Created July 29, 2016 18:13
A hacky Liquid script to allow page-specific stylesheets using Yaml Front Matter
---
---
{% assign delim = "|" %}
{% assign had_elements = "" %}
<!-- Custom Stylesheets - use custom_css in YAML front matter !-->
{% if page.custom_css %}
{% for stylesheet in page.custom_css %}
{% capture had_elements %}{{ had_elements | join: delim }}{{ delim }}{{ stylesheet }}{% endcapture %}
{% assign had_elements = had_elements | split: delim %}
<link rel="stylesheet" href="/assets/css/{{ stylesheet }}.css" type="text/css">
@Jetroid
Jetroid / union.rb
Created July 29, 2016 13:31
A plugin to allow union of arrays with Jekyll.
module Jekyll
module UnionFilter
def union(input, array)
unless array.respond_to?(:to_ary)
array = Array.new
end
InputIterator.new(input).concat(array).uniq
end
class InputIterator