Skip to content

Instantly share code, notes, and snippets.

@tessguefen
tessguefen / critcss.snippet.js
Created January 7, 2017 21:18 — forked from pibby/critcss.snippet.js
Critical CSS Finder w/media query support for those of us who write mobile-first CSS; will output to console; configurable viewport height on line 12.
/* Critical CSS Finder w/media query support and output to console
by Katie Harron - https://github.com/pibby - https://pibby.com
forked from james-Ballyhoo (https://gist.github.com/james-Ballyhoo/04761ed2a5778c505527) who forked from PaulKinlan (https://gist.github.com/PaulKinlan/6284142)
I don't know why this isn't keeping my 2 space indents :(
*/
(function() {
function findCriticalCSS(w, d) {
// Pseudo classes formatting
var formatPseudo = /([^\s,\:\(])\:\:?(?!not)[a-zA-Z\-]{1,}(?:\(.*?\))?/g;
@tessguefen
tessguefen / example.xml
Created December 14, 2016 22:04
Get Categories with Parent Categories in list.
<mvt:do file="g.Module_Library_DB" name="l.success" value="CategoryList_Load_Offset_Product_Assigned( l.settings:product:id, 0, '', '', 999, l.next, l.settings:product:categories )" />
<mvt:assign name="l.settings:product:category_list" value="''" />
<mvt:foreach iterator="cat" array="product:categories">
<mvt:assign name="l.temp_category_string" value="''" />
<mvt:assign name="l.parent_id" value="l.settings:cat:parent_id" />
<mvt:while expr="l.parent_id NE 0">
<mvt:do file="g.Module_Library_DB" name="l.success" value="Category_Load_ID( l.parent_id, l.loaded_category )" />
<mvt:assign name="l.parent_id" value="l.loaded_category:parent_id" />
<mvt:assign name="l.temp_category_string" value="l.temp_category_string $ '/' $ l.loaded_category:name" />
</mvt:while>
@tessguefen
tessguefen / accept-json.mvt
Last active December 7, 2016 21:23 — forked from steveosoule/01__accept-json-post-data.xml
Miva s.content_data to Read Raw POST Data
<h2>s.content_data</h2>
<pre><mvt:eval expr="s.content_data"/></pre>
<h2>miva_json_decode(s.content_data, l.settings:json)</h2>
<mvt:assign name="l.result" value="miva_json_decode(s.content_data, l.settings:json)" />
<p><b>&amp;mvt:json:foobar; =</b> &mvt:json:foobar;</p>
<p><b>&amp;mvt:json:message; =</b> &mvt:json:message;</p>
@tessguefen
tessguefen / example.xml
Created December 6, 2016 21:38
Order report with dynamic headers (product codes).
<mvt:assign name="l.comma" value="asciichar('44')" />
<mvt:assign name="l.linebreak" value="asciichar('10')" />
<mvt:foreach iterator="order" array="admin_order:orders">
<mvt:foreach iterator="group" array="order:groups">
<mvt:comment> <!-- Build Dynamic Array --> </mvt:comment>
<mvt:if expr="miva_array_search( l.settings:products, 0, l.item, 'l.item:code EQ l.settings:group:code' )">
<mvt:assign name="l.item:quantity" value="l.item:quantity + l.settings:group:quantity" />
<mvt:assign name="l.item:subtotal" value="l.item:subtotal + l.settings:group:subtotal" />
<mvt:else>
@tessguefen
tessguefen / example.xml
Last active December 7, 2016 16:14
Group Products Codes together into new array
<mvt:foreach iterator="group" array="basket:groups">
<mvt:comment> <!-- Build Dynamic Array --> </mvt:comment>
<mvt:if expr="miva_array_search( l.settings:new_array, 0, l.item, 'l.item:code EQ l.settings:group:code' )">
<mvt:assign name="l.item:quantity" value="l.item:quantity + l.settings:group:quantity" />
<mvt:else>
<mvt:assign name="l.success" value="miva_array_insert( l.settings:new_array, l.settings:group, -1 )" />
</mvt:if>
<mvt:comment> <!-- Build Dynamic Array --> </mvt:comment>
</mvt:foreach>
@tessguefen
tessguefen / .htaccess
Created September 18, 2016 18:48 — forked from ludo237/.htaccess
The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
<!DOCTYPE html>
<html>
<head>
<title>Google+ Login</title>
<mvt:item name="oauth-js" />
<mvt:item name="oauth-css" />
</head>
<body>
@tessguefen
tessguefen / blarggg.xml
Created July 29, 2016 21:35
Randomize Array -- miva
<mvt:comment>JSON Data</mvt:comment>
<mvt:assign name="l.settings:rotating_img_data" value="'[
{
\"name\": \"Ben1\",
\"number\": \"(800) 520-2890\",
\"src\": \"http://www.example.com/img/bio/ben.png\"
},
{
\"name\": \"James2\",
\"number\": \"(951) 123-4567\",
@tessguefen
tessguefen / header-example.php
Last active March 17, 2017 23:01
Transient for WordPress & Miva Blog
if ( false === ( $mivaHeader = get_transient( 'miva_header' ) ) ) {
$mivaHeader = file_get_contents("http://" . $hostname . "/mm5/merchant.mvc?Screen=WP-HEADER");
set_transient( 'miva_header', $mivaHeader, 24 * HOUR_IN_SECONDS );
}
echo $mivaHeader;
@tessguefen
tessguefen / load_image.readytheme.xml
Last active May 31, 2016 17:16
Load in Image (readytheme) with link, alt text, etc.
<mvt:assign name="g.my_dynamic_name" value="g.Category_Code $ '_image1'" />
<mvt:item name="readytheme" param="Load_image( g.my_dynamic_name, g.sfnt_hero )" />
&mvt:global:sfnt_hero:active; etc..
<mvt:if expr="g.sfnt_hero:link_type EQ 'P'">
<mvt:do name="g.sfnt_hero:loadprod" file="g.Module_Library_DB" value="Product_Load_Code(g.sfnt_hero:link_dest, g.sfnt_hero:product) " />
<mvt:do file="g.Module_Feature_URI_UT" name="g.sfnt_hero:link" value="Store_Product_URL(g.sfnt_hero:product, NULL)" />
<mvt:elseif expr="g.sfnt_hero:link_type EQ 'C'">
<mvt:do name="g.sfnt_hero:loadcat" file="g.Module_Library_DB" value="Category_Load_Code(g.sfnt_hero:link_dest, g.sfnt_hero:category) " />