Skip to content

Instantly share code, notes, and snippets.

View darolo's full-sized avatar

Darío Gómez Fisicaro darolo

View GitHub Profile
getPromiseWithProgress(resolver){
return new (function PromiseWithProgress(){
let observers = [],
blockNotify = false,
notify = data => !blockNotify && observers.forEach(observer => observer(data)),
promise = new Promise((resolve, reject) => resolver(resolve, reject, notify))
this.progress = function(observer){ typeof observer === 'function' && observers.push(observer); return this }
class Observable {
constructor(){
this.observers = []
}
add(callback){
@darolo
darolo / LinkWithDataPost.js
Last active August 21, 2018 12:59
LinkWithDataPost
(function(factory){
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
@darolo
darolo / Countries.xml
Created July 30, 2018 21:10
Countries XML whit ISO2 and ISO3
<Countries>
<Country name="Afghanistan" iso2="AF" iso3="AFG" id="004" />
<Country name="Aland Islands" iso2="AX" iso3="ALA" id="248" />
<Country name="Albania" iso2="AL" iso3="ALB" id="008" />
<Country name="Algeria" iso2="DZ" iso3="DZA" id="012" />
<Country name="American Samoa" iso2="AS" iso3="ASM" id="016" />
<Country name="Andorra" iso2="AD" iso3="AND" id="020" />
<Country name="Angola" iso2="AO" iso3="AGO" id="024" />
<Country name="Anguilla" iso2="AI" iso3="AIA" id="660" />
<Country name="Antarctica" iso2="AQ" iso3="ATA" id="010" />
@darolo
darolo / XML Country List
Created July 30, 2018 20:51 — forked from nathanhornby/XML Country List
XML Country list, with country code, ISO number, continent, handle and alternative spelling attributes.
<?xml version='1.0' encoding='UTF-8'?>
<countries>
<country code='af' handle='afghanistan' continent='asia' iso='4'>Afghanistan</country>
<country code='al' handle='albania' continent='europe' iso='8'>Albania</country>
<country code='dz' handle='algeria' continent='africa' iso='12'>Algeria</country>
<country code='as' handle='american-samoa' continent='polynesia' iso='16'>American Samoa</country>
<country code='ad' handle='andorra' continent='europe' iso='20'>Andorra</country>
<country code='ao' handle='angola' continent='africa' iso='24'>Angola</country>
<country code='ai' handle='anguilla' continent='north america' iso='660'>Anguilla</country>
<country code='aq' handle='antarctica' continent='antarctica' iso='10'>Antarctica</country>
@darolo
darolo / Countries.html
Created July 24, 2018 13:40
Countries Select
<select name="Nationality" data-autocomplete="" class="ec-ac-select">
<option value="" selected="">Desconocido</option>
<option value="AFG">Afghanistan</option>
<option value="ALA">Åland Islands</option>
<option value="ALB">Albania</option>
<option value="DZA">Algeria</option>
<option value="ASM">American Samoa</option>
<option value="AND">Andorra</option>
<option value="AGO">Angola</option>
<option value="AIA">Anguilla</option>
@darolo
darolo / Countries.xml
Created July 24, 2018 13:27
Countries XML
<Countries>
<Country name="Afghanistan" iso3="AFG" id="004"/>
<Country name="Åland Islands" iso3="ALA" id="248"/>
<Country name="Albania" iso3="ALB" id="008"/>
<Country name="Algeria" iso3="DZA" id="012"/>
<Country name="American Samoa" iso3="ASM" id="016"/>
<Country name="Andorra" iso3="AND" id="020"/>
<Country name="Angola" iso3="AGO" id="024"/>
<Country name="Anguilla" iso3="AIA" id="660"/>
<Country name="Antarctica" iso3="ATA" id="010"/>
@darolo
darolo / nationality.html
Created July 24, 2018 13:10 — forked from didats/nationality.html
Nationality List in HTML Dropdown
<select name="nationality">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
@darolo
darolo / getOptionsFromElement.js
Last active July 20, 2018 13:23
Get options from element
function queryStringToJSON(string){
var result = {};
string.replace(/([^;&]+)[=:]+([^;&]+)/g, function(match, key, value, begin, fullstring){
result[key] = value;
});
@darolo
darolo / Load Images.js
Last active July 18, 2018 13:17
Verify when a collection of image url loads
(function(w, d, $, undefined){
$.LoadImages = function(){
var deferreds = [];
$.each(arguments, function(i, url){
var
img = d.createElement('img'),