Skip to content

Instantly share code, notes, and snippets.

View niveshsaharan's full-sized avatar

Nivesh Saharan niveshsaharan

View GitHub Profile
window.addEventListener("Sellify::UCD::TieredFreeItemsRendered", function(){
setTimeout(function(){
$( '#sellify-ucd-tiered-free-items-container .ucd-unlocked-offer .upsell-submit' ).each( function(){
var cartIds = sellify.ucd.original_cart.items.map( function( item ){
return item.variant_id;
} );
var id = $( this ).closest( 'form' ).find( '[name="id"]' ).val()
if( ! cartIds.includes( id ) )
{
$(this).click()
@niveshsaharan
niveshsaharan / Handlebars_Helpers.js
Created September 11, 2019 10:12
Handlebars custom helpers
/**
* eq helper to check if the given values are equal
*
* {{#eq 4 4}} The values are equal {{/eq}}
*/
Handlebars.registerHelper('eq', function(a, b) {
const next = arguments[arguments.length - 1];
return a === b ? next.fn(this) : next.inverse(this);
});
@niveshsaharan
niveshsaharan / sellify-partners-create-shop.php
Last active August 18, 2019 06:41
Sellify Partners - Create referred shop
<?php
$accessToken = 'MY_ACCESS_TOKEN_GENERATED_FROM_ADMIN_ACCOUNT';
curl_advance([
'URL' => 'https://partners.mydomain.com/api/shops',
'METHOD' => 'POST',
'HEADERS' => [
'Accept: application/json',
'Authorization: Bearer ' . $accessToken,
],
@niveshsaharan
niveshsaharan / JsColor.vue
Last active November 21, 2021 12:03
Vue.js Component for http://jscolor.com/
<template>
<div class="input-control color-input">
<input :value="value"
:id="id"
class="jscolor-input {hash:true,styleElement:'',onFineChange:'jsColorOnFineChange(this)'}"
@change="onChange($event.target)"
@input="onChange($event.target)"
@focus="showColorPicker"
@onFineChange="onFineChange"
ref="color_input"
@niveshsaharan
niveshsaharan / JsColor.js
Last active March 13, 2022 04:01
React.js Component for jscolor.com
import React, { Component } from 'react';
import '../plugins/jscolor/jscolor';
/**
* JsColor
*/
class JsColor extends Component {
/**
* JsColor Constructor
* @param {*} props