Skip to content

Instantly share code, notes, and snippets.

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

Diego Castaño dowrow

🏠
Working from home
View GitHub Profile
const lines = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, h6'))
.map((heading) => {
const number = parseInt((heading.tagName.split('H'))[1], 10);
const dashes = number > 0? Array(number).fill('-').join('') : '';
return `${heading.tagName} ${dashes} ${heading.innerHTML}`;
});
const result = lines.join('\n');
console.log(result);
@dowrow
dowrow / git
Created July 31, 2019 10:21
Mover tags de commit
1. Pillas el listado de tags (del comentario del commit)
2. git push --delete origin tag1 tag2...
3. git tags -d tag1 tag2...
4. Te pones en el commit a etiquetar
5. git tag tag1 && git tag tag2...
6. git push --tags
@dowrow
dowrow / .eslintrc.js
Created July 30, 2019 08:12
Force eslint to use webpack to resolve modules
module.exports = {
extends: ['@open-wc/eslint-config', 'eslint-config-prettier'].map(require.resolve),
settings: {
'import/resolver': {
webpack: {
config: {
resolve: {
modules: ['node_modules'],
},
},
// Navigate to tweet URL eg: https://twitter.com/onix_negro81/status/1086353323580624897
// Open Chrome developer console
// Paste this and hit enter:
document.querySelector('.request-favorited-popup').click();
document.querySelectorAll('.not-blocked')
.forEach((notBlockedButton) => {
notBlockedButton.click();
document.querySelector('.block-button').click();
});
@dowrow
dowrow / getcodes.js
Created December 5, 2018 22:34
Bruteforce JustEat
// Copy your 22char code from https://www.just-eat.es/paymentoptions/XXXXXXXXXXXXXXXXXXXXXX?SendPreOrderAnalyticsEvent=False
const PAYMENT_OPTION = 'XXXXXXXXXXXXXXXXXXXXXX';
const seeds = ['JUSTEAT', 'DESCUENTO', 'LUNES', 'MARTES', 'MIERCOLES', 'JUEVES', 'VIERNES', 'SABADO', 'DOMINGO'];
const payload = { "credentials": "include", "headers": { "accept": "*/*", "accept-language": "en,es-ES;q=0.9,es;q=0.8", "cache-control": "no-cache", "pragma": "no-cache", "x-requested-with": "XMLHttpRequest" }, "referrer": `https://www.just-eat.es/paymentoptions/${PAYMENT_OPTION}?SendPreOrderAnalyticsEvent=False`, "referrerPolicy": "no-referrer-when-downgrade", "body": null, "method": "GET", "mode": "cors" };
seeds.forEach(seed => {
for (let i = 0; i < 100; i++) {
let codes = [`${seed}${i}`, `${i}${seed}`];
codes.map(code => {
@dowrow
dowrow / shake-animation.css
Last active November 6, 2018 11:56
Shake animation fragment
@-webkit-keyframes shake {
0%,
to {
-webkit-transform: translateZ(0);
transform: translateZ(0)
}
10%,
30%,
50%,
70%,
@dowrow
dowrow / test.js
Created September 17, 2018 13:04
Te la comiste
/*
_ _
.-/ / )
|/ / /
/.' /
// .---.
/ .--._\
/ `--' /
/ .---'
/ .'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import time
import sys
import os
def main(argv):
    if len(sys.argv) < 5:
@dowrow
dowrow / capture-explained.py
Created April 13, 2017 16:50
Explicación de script
# Estas 2 líneas dicen que esto es Python y que puede haber caracteres utf-8 como tildes, etc.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Importo los módulos que necesito
# Para hacer peticiones a urls
import urllib
# Para esperar intervalos de tiempo
import time
# Para manipular la entrada/salida por la consola
@dowrow
dowrow / gist:98b4a6e14f0e7f1eab3a
Created May 13, 2015 10:28
Notificaciones para Facebook
<?php
/*
* Sends a notification to a user
* @param $userid Facebooks user id
* @param $text Templated text for the notification
* @param $href Relative path to append to the canvas URL
* @return true if ok, empty string otherwise
*/
public function sendNotification ($userid, $text, $href) {