Skip to content

Instantly share code, notes, and snippets.

View maggiben's full-sized avatar

Benjamin maggiben

  • Frávega
  • Argentina
View GitHub Profile
@maggiben
maggiben / playlist.json
Last active January 5, 2017 14:28
yt-playlist
{
"video": "https://www.youtube.com/watch?v=fNdeLSKSZ1M",
"artist": "Sia",
"title": "Fire Meet Gasoline (by Heidi Klum)"
}, {
"video": "https://www.youtube.com/watch?v=f-BXrRf9_rk",
"artist": "Portugal",
"album": "the man",
"title": "Guns and Dogs"
}
@maggiben
maggiben / chaining.js
Last active January 30, 2017 20:59
Chain promises
function getUsers() {
return new Promise((resolve, reject) => {
setTimeout(function () {
return resolve('benja')
}, 1000)
})
}
function getIssues(user) {
var issues = {
@maggiben
maggiben / levenshtein.js
Created February 8, 2017 11:51 — forked from hardware/levenshtein.js
Levenshtein distance
/*
Copyright (c) 2006. All Rights reserved.
If you use this script, please email me and let me know, thanks!
Andrew Hedges
andrew (at) hedges (dot) name
If you want to hire me to write JavaScript for you, see my resume.
/*
This script is free to use under the license below.
No obligation, but if you use this it I'd love to know, thanks!
Andrew Hedges, [email protected]
-----------------------------------------------------------------------------
The MIT License (MIT)
@maggiben
maggiben / regions.json
Created February 8, 2017 23:23
This is a list of commonly used acronyms of regional designations used for government, marketing and business purposes.
{
"africa": {
"eastern africa": ["burundi", "comoros", "djibouti", "eritrea", "ethiopia", "kenya", "madagascar", "malawi", "mauritius", "mayotte", "mozambique", "réunion", "rwanda", "seychelles", "somalia", "south sudan", "uganda", "united republic of tanzania", "zambia", "zimbabwe", ""],
"middle africa": ["angola", "cameroon", "central african republic", "chad", "congo", "democratic republic of the congo", "equatorial guinea", "gabon", "sao tome and principe", ""],
"northern africa": ["algeria", "egypt", "libya", "morocco", "sudan", "tunisia", "western sahara", ""],
"southern africa": ["botswana", "lesotho", "namibia", "south africa", "swaziland", ""],
"western africa": ["benin", "burkina faso", "cabo verde", "cote d'ivoire", "gambia", "ghana", "guinea", "guinea-bissau", "liberia", "mali", "mauritania", "niger", "nigeria", "saint helena", "senegal", "sierra leone", "togo", ""],
},
"americas": {
"latin america and the caribbean": [""],
var MAP = null;
// This example creates a simple polygon representing the Bermuda Triangle.
function initMap() {
MAP = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: {
lat: 24.886,
lng: -70.268
MKS BASE V1.3 32-bit
https://www.amazon.com/printer-motherboard-compatible-motherboards-Smoothieware/dp/B01KO57OGS/ref=sr_1_30?s=industrial&ie=UTF8&qid=1487182518&sr=1-30
@maggiben
maggiben / getQuarter.js
Created February 21, 2017 18:19
Get Quarter
function getQuarter(start, count, direction) {
var d = new Date(start);
var quarter = Math.floor((d.getMonth() / 3));
switch (direction) {
case "FORWARD": return new Date(d.getFullYear(), quarter * 3, 1);
case "BACKWARD": return new Date(d.getFullYear(), quarter * 3 - (3 * count), 1);
}
return null;
}
@maggiben
maggiben / modulecheck.js
Created February 22, 2017 04:54
Check package.json module versions
/* to move into a module */
import _ from 'lodash';
import fs from 'fs';
import path from 'path';
import globby from 'globby';
import Table from 'cli-table';
import packageJson from 'package-json';
import semver from 'semver';
import colors from 'colors';
import ProgressBar from 'progress';
@maggiben
maggiben / getNumberSup.js
Created February 22, 2017 14:51
Get Sup Index Number
function getNumberSup(number) {
const sup = ['⁰','¹', '²', '³','⁴', '⁵', '⁶', '⁷', '⁸', '⁹'];
return number.toString().split('').map(x => (sup[parseInt(x)])).join('');
}