# Install http-server module globally
npm install http-server -g
# Navigate to any directory you want the server to run in
cd /path/to/dir/with/files
# Launch HTTP server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
Shopify Placeholder SVGs | |
Outputs every Shopify placeholder_svg_tag available. A simple reference to use during theme development. | |
https://shopify.dev/docs/api/liquid/filters/placeholder_svg_tag | |
{% endcomment %} | |
{%- liquid | |
assign outline_illustrations = 'product-1,product-2,product-3,product-4,product-5,product-6,collection-1,collection-2,collection-3,collection-4,collection-5,collection-6,lifestyle-1,lifestyle-2,image' | |
assign color_illustrations = 'product-apparel-1,product-apparel-2,product-apparel-3,product-apparel-4,collection-apparel-1,collection-apparel-2,collection-apparel-3,collection-apparel-4,hero-apparel-1,hero-apparel-2,hero-apparel-3,blog-apparel-1,blog-apparel-2,blog-apparel-3,detailed-apparel-1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function(){ | |
// Detect dark mode with Vanilla JS and add class to BODY | |
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { | |
document.body.classList.add("dark-mode"); // your class here | |
} | |
// Turn Dark Mode on/off, manually | |
document.querySelector('.lightsoff').onclick = function() { | |
document.querySelector('body').classList.toggle('dark-mode'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Light mode */ | |
@media (prefers-color-scheme: light) { | |
body { | |
background-color: #FFFFFF; | |
color: #000000; | |
} | |
} | |
/* Dark mode */ | |
@media (prefers-color-scheme: dark) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// With this function you can check response code if it really is 404 or nah | |
function isValidUrl($url){ | |
// first do some quick sanity checks: | |
if(!$url || !is_string($url)){ | |
return false; | |
} | |
// quick check url is roughly a valid http request: ( http://blah/... ) | |
if( ! preg_match('/^http(s)?:\/\/[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(\/.*)?$/i', $url) ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = "https://wordpress.org/latest.zip"; // URL of what you wan to download | |
$zipFile = "wordpress.zip"; // Rename .zip file | |
$extractDir = "extracted"; // Name of the directory where files are extracted | |
$zipResource = fopen($zipFile, "w"); | |
// Get The Zip File From Server | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_FAILONERROR, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make a redirect match with or without closing / | |
# example.com/highlights is the same as example.com/highlights/ | |
# something that doesn't happen with Redirect 301 | |
RedirectMatch 301 ^/highlights/?$ /highlights.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer require magento/product-community-edition 2.1.1 --no-update | |
composer update | |
rm -rf var/di var/generation | |
php bin/magento cache:clean | |
php bin/magento cache:flush | |
php bin/magento setup:upgrade | |
php bin/magento setup:di:compile | |
php bin/magento indexer:reindex | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// get current page URL | |
$URL = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]); | |
// get current product name & ID | |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); //get current product | |
$id = $product->getId(); | |
$title = $product->getName(); |
NewerOlder