Skip to content

Instantly share code, notes, and snippets.

View matiaslopezd's full-sized avatar
🛰️
matiaslopezd[at]404.city

Matías López matiaslopezd

🛰️
matiaslopezd[at]404.city
View GitHub Profile
@matiaslopezd
matiaslopezd / gist:ad3adc90fd777521b3264feab666d3c6
Created February 22, 2019 03:09 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@matiaslopezd
matiaslopezd / app.js
Created February 26, 2019 00:26 — forked from kkkrist/app.js
Rate limiting for FeathersJS HTTP (REST API) and Web Sockets connections (Express, Node.js)
'use strict'
const bodyParser = require('body-parser')
const compress = require('compression')
const configuration = require('feathers-configuration')
const cors = require('cors')
const favicon = require('serve-favicon')
const feathers = require('feathers')
const hooks = require('feathers-hooks')
const limiter = require('limiter').RateLimiter // Generic limiter used for authentication attempts inside web socket connection
@matiaslopezd
matiaslopezd / timeformat.js
Created May 14, 2019 02:29
Seconds in string "00:00:00" format
const timeFormat = (time) => {
// Time is in seconds
time = time || 0;
let seconds = time % 60;
let minutes = (time / 60) % 60;
const hours = (time / 60) / 60;
const numberToString = (value) => {
value = Math.trunc(value);
return (value < 10) ? `0${value}` : value;
@matiaslopezd
matiaslopezd / dni_cl_validator.js
Last active February 27, 2021 18:33
Chilean DNI validator and get in JSON { run: Number/String, adv: Number/String, dv: Number/String, valid: Boolean }
function DNI_CL({ run, string }){
if(run !== '' && (typeof run === "string" || typeof run === "number")){
function format(n){
if (typeof n === 'string') {
// Remove '.' if exist
n = (n.includes('.')) ? n.split('.').join('') : n;
// Remove '-' if exist
n = (n.includes('-')) ? n.split('-').join('') : n;

Keybase proof

I hereby claim:

  • I am matiaslopezd on github.
  • I am matiaslopezd (https://keybase.io/matiaslopezd) on keybase.
  • I have a public key ASBMvebxAVz_rPZagfuDNSl1p8q5nk5eZlPOGLqL-UzkvQo

To claim this, I am signing this object:

@matiaslopezd
matiaslopezd / clean.common.js
Last active February 13, 2022 02:59
Get all content of website and put inside to an Iframe. [Not compatible with X-Frame-Options: DENY]
(function(elements) {
function removeElements(elements){
elements.forEach((type) => {
const large = document.querySelectorAll(type).length;
for (let i = 0; i < large; i++) {
document.querySelector(type).remove();
}
});
}
@matiaslopezd
matiaslopezd / woocommerce-filter.js
Last active October 18, 2019 17:39
Woocommerce Filter replace for laserintima.cl
const keysProperties = { product: 'ixwpst[product_cat][]', brand: 'ixwpst[pa_marca][]' };
class WoocommerceFilter {
constructor(debug) {
this.params = new ParamsParser();
this.URL = this._parseURL();
this.nodes = () => document.querySelectorAll('ul.product-categories > li');
this.container = this._createContainer();
this.buttons = [];
@matiaslopezd
matiaslopezd / quotation.js
Last active February 14, 2020 01:05
Quotation script for atm.cl
const BigLoader = {
create: () => {
const loader = document.createElement('div');
loader.classList.add('big-loader');
const spinner = document.createElement('div');
spinner.classList.add('spin');
loader.appendChild(spinner);
document.body.appendChild(loader);
},
toggle: (x = document.querySelector('.big-loader')) => (x.classList.contains('show')) ? x.classList.remove('show') : x.classList.add('show'),
@matiaslopezd
matiaslopezd / dark-mode.css
Last active October 8, 2019 00:36
Dark mode for documentation of FeathersJS
body.dark, body.dark #app, body.dark .navbar, body.dark .sidebar, body.dark .links {
background: rgb(13, 22, 28) !important;
color: rgb(255, 255, 255);
}
body.dark .navbar{
border-bottom: 1px solid rgba(128, 128, 128, 0.35);
}
body.dark .home-link img {
@matiaslopezd
matiaslopezd / instrucciones.md
Last active February 14, 2020 03:16
How to use Woocommerce Rest API v3 - Not legacy! | Como usar Rest API de Woocommerce v3 - No heredada

Autorización

Para usar la Rest API es necesario proveer de consumer_key y consumer_secret en la URL como parámetros. (Nunca pude pasarlo en la cabecera)

Ejemplo:

https://mywebsite.com/wp-json/wc/v3/products?consumer_key=XXXX&consumer_secret=XXXX