Skip to content

Instantly share code, notes, and snippets.

View davorpa's full-sized avatar
🧑‍💻
Learn, Code, Enjoy, Repeat

David Ordás davorpa

🧑‍💻
Learn, Code, Enjoy, Repeat
View GitHub Profile
@davorpa
davorpa / iphone-gesture-scale-fix.js
Last active September 11, 2021 06:08
A easy script to put at your HTML body end to fix scale gestures on iOS devices
!(function(document, undefined) { // IIFE::start
if (!navigator.userAgent.match(/iPhone/i)) return; // only for iPhone
var metas = document.getElementsByTagName("meta"),
NORMAL_SCALE = 1.0,
MIN_SCALE = 0.25,
MAX_SCALE = 1.6;
initialize();
// document.addEventListener("gesturestart", onGestureStart, false);
@davorpa
davorpa / gpg_git_signing.md
Created September 3, 2021 04:18 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
@davorpa
davorpa / export-github-repo-labels.js
Last active December 25, 2024 13:44
Export-import Github repo labels
// 1. Go on you labels page:
// eg.: https://github.com/EbookFoundation/free-programming-books/labels
//
// 2. Paste this script in your console / save as browser bookmarklet, and then execute it
// 3. Copy the output / download files and now you can import it using https://github.com/popomore/github-labels !
//
// How to bookmark: https://gist.github.com/caseywatts/c0cec1f89ccdb8b469b1
(function(undefined) {
@davorpa
davorpa / git-pushing-multiple.rst
Created July 26, 2021 01:05 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

1- Creamos el par, seleccionamos 0
gpg --gen-key
2- Listamos las claves
gpg --list-keys
Tambien las secretas, con su fingerprint:
gpg --list-secret-keys --fingerprint
3- Podemos exportar a un fichero la clave pública
gpg --armor --export [email protected] > mypk
así como también la secreta:
gpg --export-secret-key -a "User Name" > private.key

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
//Referred link https://www.lunchbadger.com/tracking-the-performance-of-express-js-routes-and-middleware/
var express = require('express')
var uuid = require('uuid')
const bodyParser = require('body-parser');
const {
EventEmitter
} = require('events');
const profiles = new EventEmitter();
@davorpa
davorpa / braingames-with-emojis-equipos-ciclistas.md
Last active April 9, 2020 19:23
BRAINGAMES: Equipos ciclistas usando emoticonos

Braingames: Equipos ciclistas usando emoticonos

Braingames + emojis

Te propongo un juego muy didáctico con el que podrás ejercitar tu mente, más concretamente tu hemisferio cerebral izquierdo, y así prevenir el déficit cognitivo.

¡¡Dale al coco!! Que tanto meme te lo está dejando frito. xD

Es muy simple. Se trata de adivinar equipos ciclistas usando emoticonos. ¿Te apuntas al reto?

@davorpa
davorpa / braingames-with-emojis-refranes.md
Last active January 28, 2021 00:01
BRAINGAMES: Refranero español usando emoticonos

Braingames: Refranero español usando emoticonos

Braingames + emojis

Te propongo un juego muy didáctico con el que podrás ejercitar tu mente, más concretamente tu hemisferio cerebral izquierdo, y así prevenir el déficit cognitivo.

¡¡Dale al coco!! Que tanto meme te lo está dejando frito. xD

Es muy simple. Se trata de adivinar refranes usando emoticonos. ¿Te apuntas al reto?

@davorpa
davorpa / sap-snippet-validation-pan-number.absl
Last active November 18, 2019 12:00
SAP ABSL validation snippet for Indian PAN Number
// https://help.sap.com/viewer/cbcebe3cfb1647a8b0322c18dbb0b481/2019.11/en-US/7594ffd473e21014b19dc98f75a551c4.html?q=findregex
// https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenregex_syntax_specials.htm
// https://answers.sap.com/questions/10845683/sap-hrabap-pan-card-validation-check-in-pa-30-subt.html
var valid = true;
var CurrentCommon = this.Common.GetFirst();
if (CurrentCommon.IsSet())
{
var PAN_NO = CurrentCommon.PAN_NO;