Skip to content

Instantly share code, notes, and snippets.

@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;
@bheyde
bheyde / gist:26d12958c5c013dd99165a6bc182a79a
Last active May 16, 2016 20:05
Dynamic Resize Images Based on URL
//create a new page in Miva called REQUEST_IMAGE with the following code:
<mvt:assign name="l.constraints[1]:height" value="encodeentities(g.image_height)" />
<mvt:assign name="l.constraints[1]:width" value="encodeentities(g.image_width)" />
<mvt:assign name="l.imagetype_codes[1]" value="encodeentities(g.image_type)" />
<mvt:do name="l.success" file="g.Module_Library_DB" value="Product_Load_Code( encodeentities(g.Product_Code), l.settings:product )" />

Transients

A Transient is a simple way of storing cached data in the database temporarily, by giving it a custom name and a timeframe after which it will expire and be deleted.

Transients are useful when pinging another API (i.e. Wordpress, Instagram, twitter), and saving data for a set period of time.

Once the module is installed, you will find a tab under Utilities. This batch list is only used for debugging. You can view transients here, and delete them.

Please Note

@iksi
iksi / fluid-typography.css
Created January 14, 2016 11:45
Fluid typography between a min & max font-size and molten leading
/**
* Fluid typography between a min & max font-size and molten leading
* calc(minSize + (maxSize - minSize) * ((100vw - minPort) / (maxPort - minPort)));
*/
:root {
font-size: 100%;
}
body {
font-size: 1em;
@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;
@paulirish
paulirish / what-forces-layout.md
Last active July 10, 2025 08:36
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@bonzanini
bonzanini / config.py
Last active May 20, 2025 02:55
Twitter Stream Downloader
consumer_key = 'your-consumer-key'
consumer_secret = 'your-consumer-secret'
access_token = 'your-access-token'
access_secret = 'your-access-secret'
@stevekinney
stevekinney / front-end-curriculum.md
Created August 9, 2015 00:47
Front-end Curriculum Draft

Module 1

  • Semantic markup
  • HTML standards mode and quirks mode
  • HTML fundamentals
    • Classes and IDs
  • CSS fundamentals
    • Selectors
    • Resets and normalizers
    • The box model
@tessguefen
tessguefen / HTML-on-Product-Display
Last active March 16, 2016 19:51
Zoom Plugin with Variants, on load of page.
Add the following on the right side of your product display layout area (aka where the price is)
<div id="zoom-hold" class="zoom-hold" style="display: none;"><div class="inner"></div></div>
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active July 16, 2025 06:32
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest