Skip to content

Instantly share code, notes, and snippets.

View Juandresyn's full-sized avatar
🏠
Working from home

Juandres Yepes Narvaez Juandresyn

🏠
Working from home
View GitHub Profile
[
{
"name": "Suvia",
"host": "hisuvia.com",
"punish": false
}
]
@Juandresyn
Juandresyn / electric-confetti-protection.js
Last active November 21, 2023 00:50
electric-confetti-protection.js
const name = 'ele' + 'ctr' + 'ic' + 'con' + 'fet' + 'ti';
const allowedDomains = [
`${name}.co${'m'}`,
'shopify',
'myshopify',
'127.0.0.1',
'localhost',
'klarna'
];
@Juandresyn
Juandresyn / local-orm.js
Created December 29, 2022 03:33
BD local orm
class Sql {
repository;
constructor() {
this.repository = [];
}
createTable(tableName, values) {
this.repository.push({
[tableName]: {
@Juandresyn
Juandresyn / accordion.liquid
Created November 22, 2021 16:12
Pure JS shopify ready accordion
{%- comment -%}
Available Variables
* id: The accordion id
* content: The tab content
* color: The color for h4 headings, borders, and icons
* number: Display the number for the tab
{%- endcomment -%}
{% if color == blank %}
{% assign color = '#3200B2' %}
@Juandresyn
Juandresyn / ts-object-to-array.ts
Created February 24, 2021 15:27
TypeScript Object to Array {} -> []
interface Map {
[key: string]: string | undefined
}
export const objectToArray = (obj: Map): string[] => {
const tempArray: string[] = [];
const keys = Object.keys(obj);
keys.forEach((i: string): string[] => {
tempArray.push(obj[i]);
{
"id": 820982911946154508,
"email": "[email protected]",
"closed_at": null,
"created_at": "2021-01-07T17:09:46-05:00",
"updated_at": "2021-01-07T17:09:46-05:00",
"number": 234,
"note": "type:PICKUP;date:21-01-2021:10:00;location:salvio",
"token": "123456abcd",
"gateway": null,
/**
* Galleria Twelve Theme
*
* Copyright (c) 2010 - 2019 worse is better UG
* Licensed under the MIT License.
*/
( function( window, factory ) {
if ( typeof define == 'function' && define.amd ) {
define( ['../galleria', 'jquery' ], function( Galleria, jQuery ) {
{
"New York": [
"New York",
"Buffalo",
"Rochester",
"Yonkers",
"Syracuse",
"Albany",
"New Rochelle",
"Mount Vernon",
@Juandresyn
Juandresyn / psyduck.js
Created June 26, 2020 22:40
Trap focus modals
function handleVisibleElements(modal, hide = null) {
let parent = $(modal).parent();
let grandparent = null;
const parentCount = $(modal).parents().length - 1;
const mainTag = $('body main').length ? 'main' : 'body';
const tagToCheck = $(`${mainTag} > article`).length
? 'article'
: '.wrapper';
const hideSiblings = element => {
$(element)
@Juandresyn
Juandresyn / queryparams.js
Last active July 5, 2023 16:57
Get query params
const getUrlParameter = (name) => {
const nameClean = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
const regex = new RegExp('[\\?&]' + nameClean + '=([^&#]*)');
const results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
const removeUrlParameter = (url, paramKey) => {
const r = new URL(url);
r.searchParams.delete(paramKey);