Skip to content

Instantly share code, notes, and snippets.

View gil--'s full-sized avatar
๐Ÿ’š
Building @ Shopify

Gil Greenberg gil--

๐Ÿ’š
Building @ Shopify
View GitHub Profile
@jonazu
jonazu / magento-urls.php
Last active July 18, 2016 14:44
Magento URLs
Mage::app()->getStore()
/* Store Id */
Mage::app()->getStore()->getStoreId()
/* Store Name */
Mage::app()->getStore()->getName()
/* Store Code */
Mage::app()->getStore()->getCode()
@matt-bailey
matt-bailey / async-and-conditional-css-loading.html
Last active March 17, 2021 22:09
A simple script (based on one by Google) for loading CSS files asynchronously and conditionally based on body tag classes
<html>
<head>
<!-- Inlined critical styles -->
<style>.blue{color:blue;}</style>
<!-- CSS loader -->
<script>
/* ==========================================================================
Load CSS asynchronously and conditionally after initial painting
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@dominikwilkowski
dominikwilkowski / shop.js
Last active October 27, 2021 16:12
Convert variant dropdown into swatches, multiple-option-sollution
/**************************************************************| CONVERT VARIANT TO SWATCHES |*/
$(function() {
if($(".single-option-selector").length) {
$(".single-option-selector").each(function(i) {
var $thisSelect = $(this);
var $newClass = "js-option-selector-" + i;
var $newOptions = '<ul class="new-variant-swatchs">';
var $currentOption = $thisSelect.val();
@zakhardage
zakhardage / Shopify Cart Permalink
Last active December 11, 2018 20:05
Shopify Cart Permalink
@whatnickcodes
whatnickcodes / magical.css
Created April 23, 2014 15:30
Video Hover Play - Probably could be more elegant...
/* Make Container Relative */
.video-wrapper {
position: relative;
}
/* Position the pause/play buttons in corner */
.video-icon-item {
font-family: "FontAwesome"; /* Font Awesome HTML Entity Trick verus using <i class="fa fa-play"></i> */
position: absolute;
right: 20px;
@thagxt
thagxt / Magento How to get the customer login, logout, register and checkout urls.php
Created April 23, 2014 12:10
Magento How to get the customer login, logout, register and checkout urls
login url
<?php echo Mage::getUrl('customer/account/login'); ?>
logout url
<?php echo Mage::getUrl('customer/account/logout'); ?>
My Account url
<?php echo Mage::getUrl('customer/account'); ?>
Register url
@codearachnid
codearachnid / wc_customer_bought_product.php
Created February 27, 2014 21:07
WooCommerce check if user has already bought product.
<?php
// if product is already in global space
global $product;
// or fetch product attributes by ID
if( empty( $product->id ) ){
$wc_pf = new WC_Product_Factory();
$product = $wc_pf->get_product($id);
}
@marekmurawski
marekmurawski / laravel-optgroup.php
Last active January 8, 2018 12:32
Laravel macro Form::select() with optgroup based on Collection field
<?php
// You can put this code into /app/routes.php for testing
/*
* Form::selectOpt()
*
* Parameters:
* $collection A I\S\Collection instance
* $name The HTML "name"
* $groupBy Field by which options are grouped
@msurguy
msurguy / List.md
Last active November 17, 2024 16:29
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):