Skip to content

Instantly share code, notes, and snippets.

View thagxt's full-sized avatar
🎯
Focusing

ʞↃ∀ɾ thagxt

🎯
Focusing
View GitHub Profile
@jaredkc
jaredkc / placeholder-svgs.liquid
Created June 18, 2024 22:52
Shopify Placeholder SVGs. Outputs every Shopify placeholder_svg_tag available.
{% comment %}
Shopify Placeholder SVGs
Outputs every Shopify placeholder_svg_tag available. A simple reference to use during theme development.
https://shopify.dev/docs/api/liquid/filters/placeholder_svg_tag
{% endcomment %}
{%- liquid
assign outline_illustrations = 'product-1,product-2,product-3,product-4,product-5,product-6,collection-1,collection-2,collection-3,collection-4,collection-5,collection-6,lifestyle-1,lifestyle-2,image'
assign color_illustrations = 'product-apparel-1,product-apparel-2,product-apparel-3,product-apparel-4,collection-apparel-1,collection-apparel-2,collection-apparel-3,collection-apparel-4,hero-apparel-1,hero-apparel-2,hero-apparel-3,blog-apparel-1,blog-apparel-2,blog-apparel-3,detailed-apparel-1'
@atikju
atikju / ajax-search-form.liquid
Last active November 11, 2024 20:41
Shopify Ajax Search
{% comment %}
This file can be added as a snippet and add it anywhere you want to display
{% endcomment %}
<div id="pageheader">
<div class="util-area">
<div class="search-box">
<form class="search-form" action="/search" method="get" _lpchecked="1">
<i class="icon-mag"></i>
<input type="text" name="q" placeholder="Search" autocomplete="off">
<input type="submit" value="→">
@asugrad
asugrad / functions.php
Last active February 16, 2024 14:29
WordPress Ninja Forms Export Submissions to CSV
/**
* WP CLI custom command to export a form submsissions from Ninja Forms
* The to_csv function will create a 'reports' directory
* if it does not exist and create a datetime stamped csv
*
* ## OPTIONS
*
* <id>
* : The form id.
* <send_to_sftp>
@vanbo
vanbo / restrict-users-to-their-own-attachments
Created May 11, 2017 09:09
WordPress Media Uploader: Restrict User to Accessing Only Files They Uploaded
add_filter( 'ajax_query_attachments_args', 'filter_query_attachments_args' );
function filter_query_attachments_args( $query ) {
// 1. Only users with access
if ( ! current_user_can( 'upload_files' ) ) {
wp_send_json_error();
}
// 2. No manipulation for admins.
// After all they have access to all images.
@jonathanmoore
jonathanmoore / gist:c0e0e503aa732bf1c05b7a7be4230c61
Last active October 7, 2024 16:54 — forked from carolineschnapp/gist:1083007
Linked options helper methods for Shopify. See this: http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options - Updated to work with sectioned themes (tested with District)
<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: [email protected]
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option
@thagxt
thagxt / dl-ex.php
Last active February 23, 2022 18:45
Download & Extract .zip with cURL directly on your server
<?php
$url = "https://wordpress.org/latest.zip"; // URL of what you wan to download
$zipFile = "wordpress.zip"; // Rename .zip file
$extractDir = "extracted"; // Name of the directory where files are extracted
$zipResource = fopen($zipFile, "w");
// Get The Zip File From Server
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
@shaik2many
shaik2many / javascript-localstorage-expiry.js
Created July 20, 2016 14:07
set timeout for localStorage or sessionStorage
http://apassant.net/2012/01/16/timeout-for-html5-localstorage/
var hours = 24; // Reset when storage is more than 24hours
var now = new Date().getTime();
var setupTime = localStorage.getItem('setupTime');
if (setupTime == null) {
localStorage.setItem('setupTime', now)
} else {
if(now-setupTime > hours*60*60*1000) {
localStorage.clear()
@noelboss
noelboss / git-deployment.md
Last active October 12, 2024 16:09
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@JimmyRittenborg
JimmyRittenborg / compress.liquid
Last active June 17, 2023 12:11
HTML Compressor in Shopify Liquid
{% comment %}
Input
{% endcomment %}{% capture _content %}{{ content }}{% endcapture %}{% comment %}
Remove redundant closing tags
{% endcomment %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% for _element in _endings %}
{% capture _end %}</{{ _element }}>{% endcapture %}