Skip to content

Instantly share code, notes, and snippets.

View r8r's full-sized avatar

Mario Rader r8r

View GitHub Profile
@r8r
r8r / copydb.php
Created December 2, 2021 10:39 — forked from kharysharpe/copydb.php
Copy a table from one MYSQL database server to another database another
<?php
/**
*
* Code was adapted from SitePoint
* http://www.sitepoint.com/forums/showthread.php?697857-Copy-mysql-table-from-one-server-to-another-through-php&s=b5b25e09ff44749d2e49e0d7c1640fd8&p=4680578&viewfull=1#post4680578
*
*/
// Prevent script from timing out
set_time_limit(0);
@r8r
r8r / shopify_files.js
Created October 11, 2021 12:17 — forked from mubbo/shopify_files.js
download images from shopify shop
function fetchPageAssets() {
let images = document.querySelectorAll('img[src*=files]');
images.forEach(function(image) {
files.push('<a href="' + image.src.replace(/_60x60/, "") + '"><img src="' + image.src.replace(/_60x60/, "") + '">');
});
}
function downloadListFile() {
let button = document.createElement("a");
let data = 'data:application/octet-stream;base64,' + window.btoa(files.join('\n'));
@r8r
r8r / target_blank.js
Created January 18, 2021 21:34 — forked from allybee/target_blank.js
Add target="_blank" to external links with pure JavaScript.
function targetBlank() {
// remove subdomain of current site's url and setup regex
var internal = location.host.replace("www.", "");
internal = new RegExp(internal, "i");
var a = document.getElementsByTagName('a'); // then, grab every link on the page
for (var i = 0; i < a.length; i++) {
var href = a[i].host; // set the host of each link
if( !internal.test(href) ) { // make sure the href doesn't contain current site's host
a[i].setAttribute('target', '_blank'); // if it doesn't, set attributes
<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus
var Shopify = Shopify || {};
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
(function(){function Asteroids(){function Vector(x,y){if(typeof x=='Object'){this.x=x.x;this.y=x.y;}else{this.x=x;this.y=y;}};Vector.prototype={cp:function(){return new Vector(this.x,this.y);},mul:function(factor){this.x*=factor;this.y*=factor;return this;},mulNew:function(factor){return new Vector(this.x*factor,this.y*factor);},add:function(vec){this.x+=vec.x;this.y+=vec.y;return this;},addNew:function(vec){return new Vector(this.x+vec.x,this.y+vec.y);},sub:function(vec){this.x-=vec.x;this.y-=vec.y;return this;},subNew:function(vec){return new Vector(this.x-vec.x,this.y-vec.y);},rotate:function(angle){var x=this.x,y=this.y;this.x=x*Math.cos(angle)-Math.sin(angle)*y;this.y=x*Math.sin(angle)+Math.cos(angle)*y;return this;},rotateNew:function(angle){return this.cp().rotate(angle);},setAngle:function(angle){var l=this.len();this.x=Math.cos(angle)*l;this.y=Math.sin(angle)*l;return this;},setAngleNew:function(angle){return this.cp().setAngle(angle);},setLength:function(length){var l=this.len();if(l)this.mul(lengt
@r8r
r8r / order-template.liquid
Created September 4, 2020 06:49 — forked from enamhasan/order-template.liquid
Shopify Order Printer Template with product image, variations and line item properties
<p style="float: right; text-align: right; margin: 0;">
{{ "now" | date: "%m/%d/%y" }}<br />
Invoice for {{ order_name }}
</p>
<div style="float: left; margin: 0 0 1.5em 0;" >
<strong style="font-size: 2em;">{{ shop_name }}</strong><br /><br />
{{ shop.address }}<br/>
{{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/>
{{ shop.country }}
@r8r
r8r / mailChimpDesignTemplate.html
Created October 3, 2019 15:46 — forked from edesilets/mailChimpDesignTemplate.html
MailChimp basic 1 column template use to have Content and Design Panels
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<!-- NAME: 1 COLUMN -->
<!--[if gte mso 15]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
@r8r
r8r / commit-message-guidelines.md
Created September 11, 2018 19:40 — forked from robertpainsi/commit-message-guidelines.md
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@r8r
r8r / gulpfile.js
Created April 18, 2017 15:36 — forked from demisx/gulpfile.js
Gulp 4 gulpfile.js
// Gulp 4
var gulp = require('gulp');
var using = require('gulp-using');
var grep = require('gulp-grep');
var changed = require('gulp-changed');
var del = require('del');
var coffee = require('gulp-coffee');
var less = require('gulp-less');
var coffeelint = require('gulp-coffeelint');
var sourcemaps = require('gulp-sourcemaps');