Skip to content

Instantly share code, notes, and snippets.

View ashukasma's full-sized avatar
🎯
Focusing

Ashish ashukasma

🎯
Focusing
View GitHub Profile
@tyteen4a03
tyteen4a03 / gist:3420a9e121d13b091343
Last active November 13, 2022 14:35
Shopify handleize function in JavaScript
// from https://github.com/Shopify/liquid/blob/63eb1aac69a31d97e343822b973b3a51941c8ac2/performance/shopify/shop_filter.rb#L100
Shopify.handleize = function (str) {
str = str.toLowerCase();
var toReplace = ['"', "'", "\\", "(", ")", "[", "]"];
// For the old browsers
for (var i = 0; i < toReplace.length; ++i) {
str = str.replace(toReplace[i], "");
}
@dlindenkreuz
dlindenkreuz / gist:a439ec4b939f0561d6d9
Last active April 9, 2024 10:43 — forked from tyteen4a03/gist:3420a9e121d13b091343
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, "");
};
I am travelling from Mumbai to SF, CA to travel to attend an conference, but Cathy Airline refused to checkin,
beacsue they say you passport is going to expire in next 6 month,
But I reviewed US SIX-MONTH CLUB update from CBP website where they allow user to travel from certain countries.
I discussed the same with other airlines (AIR INDIA), but I am not able to get any positive response
https://www.cbp.gov/sites/default/files/assets/documents/2017-Jan/Six-Month%20Club%20Update%2012-5-16.pdf
@Nicknyr
Nicknyr / houseNumbersSum.js
Created April 17, 2020 17:49
CodeSignal - House Numbers Sum
/*
A boy is walking a long way from school to his home. To make the walk more fun he decides to add up all the numbers of the houses that he passes by during his walk. Unfortunately, not all of the houses have numbers written on them, and on top of that the boy is regularly taking turns to change streets, so the numbers don't appear to him in any particular order.
At some point during the walk the boy encounters a house with number 0 written on it, which surprises him so much that he stops adding numbers to his total right after seeing that house.
For the given sequence of houses determine the sum that the boy will get. It is guaranteed that there will always be at least one 0 house on the path.
Example
For inputArray = [5, 1, 2, 3, 0, 1, 5, 0, 2], the output should be