Skip to content

Instantly share code, notes, and snippets.

View callaginn's full-sized avatar
😎
Coding

Stephen Ginn callaginn

😎
Coding
View GitHub Profile
@callaginn
callaginn / setup.sh
Last active January 19, 2021 16:14
Capture Setup Info / Generate an SSH Key for Pulling Private Setup Repo
#!/bin/bash
# Simple Alert Function
alert () {
tput bold; tput setaf 11; echo "$1"; tput sgr0;
}
# ==============================================================================
# START SETUP
/* pickadate v5.0.0-alpha.2, @license MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.pickadate = factory());
}(this, function () { 'use strict';
function styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
/* pickadate v5.0.0-alpha.2, @license MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.pickadate = factory());
}(this, function () { 'use strict';
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
@callaginn
callaginn / shopify-theme-exporter
Last active June 6, 2019 18:59
Download docs and code for all Shopify themes for further analysis. Use with caution; rate limits and latest version NOT tested.
# SHOPIFY THEME EXPORTER
# This script downloads docs / code for ALL Shopify themes for further analysis.
# For example, you can search the downloaded code for framework-specific classes
# like "col-md-", "btn-outline", etc.
# NOTE: Use with caution or you'll be rate limited! Latest version not tested.
baseUrl="https://themes.shopify.com"
destPath="$HOME/desktop/themes-shopify"
@callaginn
callaginn / ajax-contact-form.js
Last active May 3, 2024 16:38
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;
}, {});
}
@callaginn
callaginn / random.liquid
Last active June 4, 2020 05:14
Shopify Liquid Randomly Shuffle Array
{%- comment -%}
Randomly Shuffle Liquid Array
Author: Stephen Ginn at cremadesignstudio.com
Credits: Random Number function from @131_studio
Usage: {%- include 'random' with 'a,b,c,d,e' -%}
This snippet does the following:
1. Creates a new array with the provided string
2. Calculate X amount to loop, based on array size times 10.
@callaginn
callaginn / mjml-to-html.php
Last active July 7, 2020 18:06
Convert MJML to HTML With PHP (Zero Fuss Method)
<?php
$home = `printf ~`;
putenv("HOME=$home");
putenv('PATH=$PATH:/bin:/usr/bin:/usr/local/bin:$HOME/bin');
function mjml2html($mjml) {
$temp = tempnam('', '');
file_put_contents($temp, $mjml);
$html = shell_exec('. ~/.bashrc; mjml ' . $temp . ' --config.minify true');
@callaginn
callaginn / setup.sh
Last active August 27, 2020 21:10
Creates new SSH key, copies it to Github, and clones private config repo.
#!/bin/bash
#hey
br=$'\n'
b=$(tput bold)
c=$(tput sgr0)
yellow=$(tput setaf 11)
ssh_title="$(scutil --get ComputerName) ($(date +'%Y-%m-%d'))"
alert () { echo "${b}${yellow}$1${c}"; }
@callaginn
callaginn / formcarry.js
Last active December 4, 2020 17:08
FormCarry Fetch Submission with Custom Response
// jshint strict:false, undef:false, unused:false
/*/
FormCarry Ajax Functions
Last Updated 2020-12-04
// How to Initialize
ajaxFormInit().then(json => {
console.log(json.form);
console.log(json.response);
@callaginn
callaginn / sshlogin.exp
Created September 17, 2021 02:11
Expect script to supply root/admin password for remote ssh server and execute command.
#!/usr/bin/expect -f
# Expect script to supply root/admin password for remote ssh server
# and execute command.
# This script needs three argument to(s) connect to remote server:
# password = Password of remote UNIX server, for root user.
# ipaddr = IP Addreess of remote UNIX server, no hostname
# scriptname = Path to remote script which will execute on remote server
# For example:
# ./sshlogin.exp password 192.168.1.11 who
# ------------------------------------------------------------------------