Skip to content

Instantly share code, notes, and snippets.

View mmarienko's full-sized avatar
:octocat:

Maksym Marienko mmarienko

:octocat:
View GitHub Profile
@mmarienko
mmarienko / order.json.liquid
Last active September 8, 2023 13:44
Shopify order parser into Shopify Flow json data for Klaviyo
{
"additionalFees": [
{% for fee in order.additionalFees %}
{% if forloop.first != true %},{% endif %}
{
"id": {{ fee.id | json }},
"name": {{ fee. name | json }},
"price": {
"presentmentMoney": {
"amount": {{ fee.price.presentmentMoney.amount | json }},
@mmarienko
mmarienko / nouislider-relative-date.js
Last active April 11, 2023 22:55
noUiSlider - relative date
// Return milliseconds from a count of day.
function getMsFromDay(day) {
return day * 86400000;
}
// Setup
var relativeDateSlider = document.getElementById('slider-relative-date');
@mmarienko
mmarienko / accordions.js
Last active April 11, 2023 23:04
Accordions plugin by vanilla JS
new class Accordions {
constructor() {
this.$wrapper;
this.$trigger;
this.$content;
this.init();
}
init() {
@mmarienko
mmarienko / modals.js
Last active April 11, 2023 22:11
Modal windows plugin by vanilla JS
new class Modals {
constructor() {
this.init();
this.addListenersOpen();
this.addListenersClose();
this.addListenerHash();
}
init() {
@mmarienko
mmarienko / formatDate.js
Last active April 20, 2021 11:51
Format Date with internationalization
function formatDate(date) {
let year, month, day;
let yearIntl = IntlTime.formatToParts(date.getYear() - 70, 'year');
let monthIntl = IntlTime.formatToParts(date.getMonth(), 'month');
let dayIntl = IntlTime.formatToParts(date.getDate(), 'day');
year = date.getYear() - 70 ? (yearIntl[1] ? yearIntl[1].value + yearIntl[2].value + ',' : yearIntl[0].value + ',') : '';
month = +date.getMonth() ? (monthIntl[1] ? monthIntl[1].value + monthIntl[2].value + ',' : monthIntl[0].value + ',') : '';
@mmarienko
mmarienko / tabs.js
Last active March 20, 2023 15:46
Tabs plugin by vanilla JS
new class Tabs {
constructor() {
this.$wrapper;
this.$triggers;
this.$body;
this.init();
}
init() {