Skip to content

Instantly share code, notes, and snippets.

@pibby
pibby / critcss.snippet.js
Last active August 23, 2020 16:22 — forked from james-Ballyhoo/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 / SearchSpring.Catalog.afterResultsChange.js
Last active August 29, 2015 14:25 — forked from steveosoule/miva-searchspring-after-results-change.js
Search Spring - After Result Change Psuedo Example
afterResultsChange: function() {
$(document).trigger('SearchSpring_AfterResultsChange');
}
@zacbrac
zacbrac / TableTransferrer.php
Last active September 25, 2015 22:32
TableTransferrerAllows you to transfer tables from one db to another with minimal effort.No file handling necessary, you only need the table names, and a connection from db 1 to db 2.
<?php
/*
* TableTransferrer
*
* Allows you to transfer tables from one db to another with minimal effort.
* No file handling necessary, you only need the table names, and a connection from db 1 to db 2.
*
*/
RAW DATA
2_#10 Can
URL ENCODED
2_%2310%20Can
ESCAPED FOR HTACCESS
2_\%2310\%20Can
@tessguefen
tessguefen / HURRAH.xml
Last active August 29, 2015 14:17
Generate Images with Custom Width/ Height using mvdo (Thank you Ryan!!)
<mvt:item name="toolkit" param="customimagec|main|l.all_settings:product:code|main|||1" />
<mvt:assign name="l.height" value="178" />
<mvt:assign name="l.width" value="178" />
<mvt:do file="g.Module_Library_DB" name="l.image_loaded" value="Image_Load_File( g.main, l.image )" />
<mvt:if expr="l.image_loaded">
<mvt:do file="g.Module_Library_DB" name="l.generated_image_loaded" value="GeneratedImage_FindOrInsert_Image_Dimensions( l.image, l.width, l.height, l.settings:generated_image )" />
</mvt:if>
<!-- Checking -->
&mvt:generated_image;
@steveosoule
steveosoule / miva-checkout-ab-test.html
Last active August 29, 2015 14:07
Miva - Checkout A/B Test
<mvt:if expr="ISNULL g.ab_version AND ISNULL g.ab_flush">
<mvt:item name="customfields" param="Read_Basket('ab_version', g.ab_version)" />
</mvt:if>
<mvt:if expr="ISNULL g.ab_version">
<mvt:assign name="g.randomNumber" value="random(100)" />
<mvt:if expr="g.randomNumber GE 50">
<mvt:assign name="g.ab_version" value="'A'"/>
<mvt:else>
<mvt:assign name="g.ab_version" value="'B'"/>
</mvt:if>
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active October 12, 2024 16:34
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@seamusleahy
seamusleahy / NextGEN echo gallery pictures
Created February 7, 2011 19:23
Output a list of the images in a NextGEN gallery