Skip to content

Instantly share code, notes, and snippets.

@superfein
superfein / WP Customizer - Dropdown-pages
Created February 13, 2023 07:32 — forked from ajskelton/WP Customizer - Dropdown-pages
Add a Dropdown-pages field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_dropdownpages_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_dropdown_pages',
) );
$wp_customize->add_control( 'themeslug_dropdownpages_setting_id', array(
'type' => 'dropdown-pages',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Dropdown Pages' ),
'description' => __( 'This is a custom dropdown pages option.' ),
@superfein
superfein / gulpfile.js
Created February 13, 2023 07:31 — forked from derekmorash/gulpfile.js
Gulp task to compile Shopify Liquid tags in SASS with Autoprefixer
var gulp = require('gulp');
var sass = require('gulp-sass');
var replace = require('gulp-replace');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
gulp.task('compilesass', function() {
// root SASS file (contains all your includes)
return gulp.src('./sass/style.scss')
// compile SASS to CSS
// Escaping Liquid in SCSS.
//
// Expected output:
// a{
// color: {{ settings.link-color }};
// }
a{
color: #{'{{ settings.link-color }}'};
}
@superfein
superfein / tabbed-description.liquid
Created February 13, 2023 07:31 — forked from tairli/tabbed-description.liquid
Tabbed description code for Shopify. "Slice" your description with <H6> elements (which will serve as tab titles) and stop with <H5> element.
{% comment %}
if combine_pretext is false, the text before the first <h6> will be shown above all tabs, otherwise added to the first tab
if stop_on_h5 is true, tabs parsing will stop on first H5 element and the rest will be shown below tabs.
What's inside H5 is discarded, but still put something meneningfull there, just in case you switch theme or alike.
No multiple H5 elements.
{% endcomment %}
{% assign combine_pretext = false %}
{% assign stop_on_h5 = true %}
@superfein
superfein / bs-config.js
Created June 30, 2022 12:27 — forked from Kenty/bs-config.js
browser-sync setting file
/*
|--------------------------------------------------------------------------
| Browser-sync config file
|--------------------------------------------------------------------------
|
| Please report any issues you encounter:
| https://github.com/shakyShane/browser-sync/issues
|
| For up-to-date information about the options:
| https://github.com/shakyShane/browser-sync/wiki/Working-with-a-Config-File
@superfein
superfein / odd-even-in-liquid.liquid
Created June 15, 2022 19:09 — forked from joe-dempsey/odd-even-in-liquid.liquid
using modulo in liquid to case odd even in a loop
{% comment %}
Here we loop through a blog and use modulo to case odd/even.
Dead simple.
{% endcomment %}
{% for article in blog.articles %}
{% assign mod = forloop.index | modulo: 2 %}
@superfein
superfein / shopify-rte-accordion.html
Created June 12, 2022 19:22 — forked from seandogg/shopify-rte-accordion.html
Shopify Rich Text Editor Pure CSS Accordion
<!-- Begin Accordion Snippet -->
<style>
.so-tab {
position: relative;
width: 100%;
overflow: hidden;
margin: 25px 0;
}
.so-tab label {
position: relative;
@superfein
superfein / ajax-contact-form.js
Created May 18, 2022 17:34 — forked from callaginn/ajax-contact-form.js
Shopify Ajax Contact Form
// Before implementing this, you'll need to contact Shopify support and ask them to turn off Google's ReCaptcha
// for your Shopify store's contact forms. Otherwise, it will redirect to the captcha's verification page.
// Retrieves input data from a form and returns it as a JSON object:
function formToJSON(elements) {
return [].reduce.call(elements, function (data, element) {
data[element.name] = element.value;
return data;
}, {});
}
@superfein
superfein / 0-README.md
Created November 29, 2021 19:08 — forked from abhijeetchopra/0-README.md
Creating automatic scheduled backup copies of your Google Sheets using Google Apps Script

How to "Schedule Automatic Backups" of your Google Sheets

This tutorial demonstrates how to use Google Apps Script to:

  • Create copies of the Google Sheet in the desired destination folder automatically at set intervals.

  • Append the time stamp with each backup file's name.

  • Adjust time trigger for backing up every day/hour/minute.

@superfein
superfein / coverageJS.js
Last active February 13, 2023 07:33
Uses the Puppeteer node module to extract the coverage JS from Chrome, for a specific URL.
const puppeteer = require('puppeteer');
// Include to be able to export files with node
const fs = require('fs');
// This prepares the filenames for the coverage .js files
function exportJSFileName(url) {
// Remove https:// from the beginning of the string
// Remove .js* from the end of the string