Skip to content

Instantly share code, notes, and snippets.


David López Castellote Dellos7

View GitHub Profile
Dellos7 / quicksort.cpp
Created Aug 12, 2020
Algoritmo Quick Sort en C++, escogiendo como pivote el elemento central del array
View quicksort.cpp
template <typename T>
class OrdenadorQuicksort: public Ordenador<T>{
void ordenar( vector<T> &lista ){
ordenar( lista, 0, lista.size()-1 );
// Quicksort sin utilizar arrays adicionales y eligiendo el elemento central para el pivote
void ordenar( vector<T> &lista, int posIni, int posFin ){
if( posIni < posFin ){
int posPivote = (posIni+posFin)/2; // Cogemos el del medio
Dellos7 /
Last active Apr 5, 2020
Comandos útiles de terminal

Ver procesos activos escuchando en un puerto específico

sudo lsof -i :8080
php     4486 david    7u  IPv6 0xaf27373cf1790fb1      0t0  TCP localhost:http-alt (LISTEN)


Dellos7 /
Last active May 31, 2019
HOW TO: Mantain the source (stenciljs example) and the built files of your site in the 'source' and 'master' branch, respectively, in order to deploy the site to Github Pages

Deploy both the source and built site to Github Pages

This gist shows an example of how to mantain both the source (stenciljs example) and the built files of your site in the 'source' and 'master' branch, respectively, in order to deploy the site to Github Pages.

Why this is useful?

I wanted to deploy my personal site to my Github repo. However, in order to publish the site with Github Pages from your main Github pages repo (this is, <whatever>, it is a must from GH Pages to deploy it from the master branch.. So it is very difficult to easily mantain both the source and the built files for your site (I am talking about the www folder) in the same repo if you want to deploy it with GH Pages.

So with this method you are able to (thanks to git worktrees):

  • Have a source branch where you will push the source code of your site (in this example, the source files and folders of the site generated with Stencil).
Dellos7 / index.html
Created May 3, 2019
index.html completo para aplicación StackBlitz con Ionic 3 y Angular
View index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta charset="UTF-8">
<title>TÍTULO APP</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
Dellos7 / semaphore.js
Created Jan 31, 2019 — forked from Gericop/semaphore.js
A simple implementation of a semaphore in JS
View semaphore.js
function Semaphore(max) {
var counter = 0;
var waiting = [];
var take = function() {
if (waiting.length > 0 && counter < max){
let promise = waiting.shift();
Dellos7 /
Last active Jul 19, 2018
How to block Spotify and most apps ads (valid also for Android & iOS)

Block Spotify ads (and most app ads)

This is a how-to guide in order to block Spotify ads. However, this will also block most apps ads as apps usually use very similar ad providers.


This guide was done with the only aim of learning.

Blocks ads in desktop and mobile

Dellos7 / index.js
Created May 2, 2018
Tampermonkey script in order to enable browser notifications for the Web-based Microsoft Teams chat. Useful in Linux (in Linux chat notifications do not work). Tested in Chrome 66.
View index.js
// ==UserScript==
// @name Microsoft Teams Notifications
// @namespace
// @version 1.0
// @description Creates browser notifications for the Web-based Teams application. Useful in Linux (in Linux notifications do not work). Tested in Chrome 66.
// @author David López Castellote
// @match*
// @grant none
// ==/UserScript==
(function() {
Dellos7 / record.js
Last active May 9, 2019
SugarCRM - Open selection-list drawer with custom collection
View record.js
initialize: function(options) {
this.plugins = _.union(this.plugins, ['LinkedModel']);
this._super('initialize', [options]);
//Example of use 'ProductTemplates', 'revenuelineitem_templates','what I want to search' );
@param module: The module of the collection you want to retrieve records from
Dellos7 / AccessibilityClassHack.php
Created Jul 14, 2017
Helper class that allows to read private & protected properties from a specific object and also to invoke private & protected methods from a specific object
View AccessibilityClassHack.php
class AccessibilityClassHack {
* Allows you to get the value of a protected or private property of an object
* @param $obj The class object of the property you want to get access to
* @param $prop The name of the property you want to get access to
* @return Returns the property $prop value of the object $obj
You can’t perform that action at this time.