Skip to content

Instantly share code, notes, and snippets.

View delapuente's full-sized avatar

Salvador de la Puente González delapuente

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def f():
...
@delapuente
delapuente / q-programming-intro.ipynb
Last active February 9, 2019 16:36
Introduction to quantum programming.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Estimado representante y miembro del Parlamento Europero:
La sesión de voto plenaria de julio acerca de la Directiva de Copyright en el Mercado Único Digital podría causar un daño irreparable a la totalidad de Internet, a los derechos y libertades fundamentales sobre los que se fundamentan nuestros países y a la economía de la Unión Europea, al mismo tiempo que crea un estado de incertidumbre legal de cara al futuro.
Es, por tanto, crucial que votéis en contra del mandato de negociación (regla 69c) propuesto por el miembro del Parlamento Europero Axel Voss. Necesitamos que os mantengáis firmes en contra de esta propouesta desequilibrada. Para explicaros por qué, quisiera recordar algunas de las numerosas cartas y análisis enviados por numerosos expertos sobre lo qué está en juego si el Artículo 13 sale adelante:
Internet, como un todo: cerca de 70 pioneros de Internet y expertos se han agrupado alrededor de Sir Tim Berners-Lee para escribir una carta [1], el 12 de junio de 2018, dirigida al Parlamento Euro
@delapuente
delapuente / wp-collaborative-sw.php
Created January 25, 2016 09:56
WordPress proposal for a collaborative method for writing service workers
// Plugin 1:
sw_add_to_service_worker('/path/to/scope', function () {
// contents for the service worker...
});
// Plugin 2:
sw_add_to_service_worker('/path/to/scope', function () {
// contents for the service worker...
});
@delapuente
delapuente / wp-service-worker-extensions.php
Last active January 25, 2016 09:51
WordPress API extensions to support ServiceWorkers
// Enqueue API extension for the registration script
// This uses wp_enqueue_script() to register it with a well known name such as sw-registration:/path/to/scope
sw_enqueue_registration_script('/path/to/scope');
// Plugin 1
wp_enqueue_script('plugin-1-sw-setup', '/plugin1/js/manager.js', array('sw-registration:/path/to/scope'));
// Plugin 2
wp_enqueue_script('plugin-2-sw-setup', '/plugin2/js/manager.js', array('sw-registration:/path/to/scope'));

A set of python demos, you can import them using gistimporter:

# pip install gistimporter

Then, run a Python session and do:

import gistimporter
@delapuente
delapuente / mtask-cli-spec.md
Last active September 21, 2018 14:24
Especificación para la interfaz de línea de comandos (CLI) de μTask

μTask CLI

μTask CLI es la interfaz de línea de comandos para gestionar tus tareas en formato mtask.

Instalación

Descarga el ejecutable mtask, dale permisos de ejecución y añádelo a tu PATH de forma que esté disponible para todo el mundo.

¿Dónde están las tareas?

Las tareas se almacenan en el directorio por defecto del usuario, por defecto en ~/.tasks/tasks.txt pero este ajuste se puede alterar cambiando la opción mtask_dir en el archivo de configuración.

@delapuente
delapuente / promise-chain.js
Last active August 29, 2015 14:02
The PromiseChain class allow to build chains of promises where new tasks returning promises can be added and will be executed once all thre previous tasks are done..
function PromiseChain() { this._current = null; }
PromiseChain.prototype.add = function (task) {
if (this._current === null) {
this._current = task();
}
else {
var next = function () { return task(); };
this._current = this._current.then(next, next);
}
@delapuente
delapuente / function-promise-retry.js
Created February 17, 2014 19:00
Promise retry method for functions returning a thenable interface
Function.prototype.retryWhile = function(keepTrying) {
var target = this;
var retryCount = 1;
var fulfill, reject;
var promise = new Promise(function (f, r) {
fulfill = f;
reject = r;
});