Skip to content

Instantly share code, notes, and snippets.

View ashukasma's full-sized avatar
🎯
Focusing

Ashish ashukasma

🎯
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Bootstrap Modals only - by shlomo hassid</title>
<script type='text/javascript' src='//code.jquery.com/jquery-1.11.0.js'></script>
<style type='text/css'>
[role="button"] {
cursor: pointer;
}
@ashukasma
ashukasma / image.css
Created December 17, 2015 08:00
Shopify image cross fading
.grid-link__image-centered{
display:block;
position:relative;
.original{
opacity:1;
transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-webkit-transition: opacity 1s ease-in-out;
}
@ashukasma
ashukasma / Theme
Last active December 17, 2015 08:02
Sale Banner code
{% include 'black-friday-sale-banner' %}
var ajax = {};
ajax.x = function () {
if (typeof XMLHttpRequest !== 'undefined') {
return new XMLHttpRequest();
}
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
{% tablerow product in collection.products cols: 3 %}
<div class = "image">
<a href="{{ product.url | within: collection }}"
title="{{ product.title }}">
<img src="{{ product.images.first | product_img_url: 'small' }}"
alt="{{ product.title }}" /></a>
</div>
<div class = "details">
{"id":"08c8b5f2-5c66-c9e2-a487-d38c5b6bc42d","name":"cart issue","timestamp":1453716073907,"requests":[{"collectionId":"08c8b5f2-5c66-c9e2-a487-d38c5b6bc42d","id":"6be104e2-02ca-7024-083c-10a273e00ed3","name":"http://purplesageyarns.com/cart/change.js","description":"","url":"http://purplesageyarns.com/cart/change.js","method":"POST","headers":"","data":[{"key":"line","value":"1","type":"text"},{"key":"quantity","value":"19","type":"text"}],"dataMode":"params","timestamp":0,"responses":[],"version":2},{"collectionId":"08c8b5f2-5c66-c9e2-a487-d38c5b6bc42d","id":"7510e0ae-3ef8-1c60-8293-54f8767ce8a8","name":"http://purplesageyarns.com/cart/add.js","description":"","url":"http://purplesageyarns.com/cart/add.js","method":"POST","headers":"","data":[{"key":"id","value":"14566848771","type":"text"},{"key":"quantity","value":"1","type":"text"}],"dataMode":"params","timestamp":0,"responses":[],"version":2}]}
@ashukasma
ashukasma / gist:b5dabcd6d14117366174
Created March 20, 2016 01:10 — forked from dlindenkreuz/gist:a439ec4b939f0561d6d9
Shopify handleize function in JavaScript
// one-liner version
// retains latin-1 supplement chars as well as latin extended-a and latin extended-b
Shopify.handleize = function (str) {
return str.toLowerCase().replace(/[^\w\u00C0-\u024f]+/g, "-").replace(/^-+|-+$/g, "");
};
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
}
.parent:hover .child {
display: block;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
}
@-webkit-keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@ashukasma
ashukasma / imgURL.js
Created August 25, 2016 13:19 — forked from DanWebb/imgURL.js
Specify a size for a Shopify image asset url. Equivalent to the liquid image size filter: `{{ image | img_url: "medium" }}`
String.prototype.imgURL = function(size) {
// remove any current image size then add the new image size
return this
.replace(/_(pico|icon|thumb|small|compact|medium|large|grande|original|1024x1024|2048x2048|master)+\./g, '.')
.replace(/\.jpg|\.png|\.gif|\.jpeg/g, function(match) {
return '_'+size+match;
})
;
};