Skip to content

Instantly share code, notes, and snippets.

View ferares's full-sized avatar

Fermín Ares ferares

View GitHub Profile
@pablogiralt
pablogiralt / shopify-handlelize-javascript-function.js
Last active July 11, 2025 18:26
Shopify handlelize function in javascript
// handlelize in liquid: https://github.com/Shopify/liquid/blob/63eb1aac69a31d97e343822b973b3a51941c8ac2/performance/shopify/shop_filter.rb#L100
// how to handlelize in js: https://ricardometring.com/javascript-replace-special-characters
function handlelize (str) {
str = str.normalize('NFD').replace(/[\u0300-\u036f]/g, '') // Remove accents
.replace(/([^\w]+|\s+)/g, '-') // Replace space and other characters by hyphen
.replace(/\-\-+/g, '-') // Replaces multiple hyphens by one hyphen
.replace(/(^-+|-+$)/g, '') // Remove extra hyphens from beginning or end of the string
.toLowerCase(); // To lowercase
@lucianolacurcia
lucianolacurcia / bcuapi.md
Last active May 16, 2025 17:52
BCU API - Uruguay - Obtener cotizaciones - minidocs

Cotizaciones BCU:

Para obtener las cotizaciones del Banco Central de Uruguay a través de su API se debe llamar al enpoint:

https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsbcucotizaciones?wsdl

Utilizando el método http POST, añadiendo en el body de la solicitud, un xml con el sigiuente formato:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cot="Cotiza">
   <soapenv:Header />
@neilsb
neilsb / jellyfin-windows-server.md
Last active September 19, 2025 12:20
Windows Defender - Jellyfin access

Jellyfin for Windows

Windows Defender Firewall Setup

After installing Jellyfin on Windows, you may need to update your firewall settings to allow remote connections. Below are the basic steps required to configure Windows Defender Firewall

  1. Open Windows Defender Firewall Application
  2. Select Advanced Settings from the left hand menu (Administrator privs will be required)
  3. Right click on Inbound Rules from the menu on the left, and select New Rule
  4. In the wizard, enter the following values
@neg4n
neg4n / paste-this-into-console.js
Created April 26, 2021 20:39
Unregister all service workers in Safari
// Simple & convinient way to remove all service workers registered for specific web page
// Useful when working with PWA
// Paste code below to the console, it should return Promise
const getRidOfAllServiceWorkers = async () => {
const registry = await navigator.serviceWorker.getRegistrations()
for (const entry of registry) {
entry.unregister()
}
}
@MogulChris
MogulChris / functions.php
Last active July 31, 2022 23:37
Hooking into the native WooCommerce product import
<?php
//Since 3.x WooCommerce has had an excellent native product import/export.
//You can do a huge amount just by tweaking your CSV to load meta values into the correct meta fields for your destination site.
//It'll even import images from the source site by URL if possible, and upload them to the destination site.
//If you need to do something a little fancier for every product you import, check out the woocommerce_product_import_* hooks here https://woocommerce.github.io/code-reference/hooks/hooks.html
//You can modify the CSV data before it's used, and modify the resulting WC_Product during and after creation
//eg do something to every product after it's created
@hayahyts
hayahyts / ViewController.swift
Last active June 21, 2025 01:38
How to prevent WKWebView to repeatedly ask for permission to access location?
import UIKit
import WebKit
import CoreLocation
class ViewController: UIViewController , CLLocationManagerDelegate, WKScriptMessageHandler{
var webView: WKWebView?
var manager: CLLocationManager!
override func viewDidLoad() {
super.viewDidLoad()
@Jamp
Jamp / cotizaciones.php
Created February 13, 2019 00:41 — forked from jtechera/cotizaciones.php
Cotizacion de monedas y U.I. desde el BCU (Uruguay)
<?php
function getCotizaciones($monedas = true)
{
$url = 'https://www.bcu.gub.uy/_layouts/BCU.Cotizaciones/handler/CotizacionesHandler.ashx?op=getcotizaciones';
$data = "";
$last_date_found = false;
$diff = 1;
$cotizaciones = array();
$codigosAceptados = array("USD", "EURO", "CHF", "GBP", "ARS", "BRL", "JPY", "U.I.");
@MaskeZen
MaskeZen / cotizacionBCU.php
Created August 16, 2018 14:23
Cotización del BCU WS
<?php
getCotizacionesWS();
function getCotizacionesWS(){
$context = [
"ssl" => [
"verify_peer" => FALSE,
"verify_peer_name" => FALSE,
'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT
@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@jakubfiala
jakubfiala / custom_console.js
Created February 1, 2016 14:05
this small script intercepts the standard console methods and provides a way of accessing their messages, as well as stack traces, which is really cool. it formats the stack traces for popular browsers
//==========================================================
// CUSTOM JAVASCRIPT CONSOLE
// built by jakub fiala
//
// this small script intercepts the standard console methods
// and provides a way of accessing their messages,
// as well as stack traces, which is really cool.
// it formats the stack traces for popular browsers
//
// contributions welcome!