Skip to content

Instantly share code, notes, and snippets.

View navio's full-sized avatar
🎯
Focusing

Alberto Navarro navio

🎯
Focusing
View GitHub Profile
@navio
navio / database.ts
Created September 15, 2019 03:22
Database Implementation with IndexDB
import { Store,set,get,keys,del } from 'idb-keyval';
const DBNAME = "PodcastSuite";
export interface IDBConfig{
name: string;
database?: string;
}
export abstract class PodcastSuiteDatabase {
@navio
navio / 8Puzzle.js
Created July 23, 2019 15:49
8 Puzzle Game Class
/*
1 2 3
8 _ 5
4 7 6
1 2 3
8 6 5
4 7 _
@navio
navio / class.css
Created July 23, 2019 00:19
BoardGame Example ♠♥♣♦
body {
background-color: #59A856;
}
.card{
background-color: white;
border: 1px solid red;
width: 100px;
height: 120px;
float:left;
@navio
navio / puckLight.js
Created September 27, 2018 11:37
PuckJS - Light switch
const LEDS = [LED1,LED2,LED3];
const onBtnClick =
(fn)=> setWatch(fn, BTN, {edge:"rising", debounce:50, repeat:true});
const turnOn = (el) => {
el.write(true);
};
const turnOff = (el) => {
@navio
navio / ReadingWritting.js
Last active August 1, 2018 01:24
Copying data from a CSV to Another. 🗂
// Archivo
var stream = fs.createReadStream("fromDistributor.csv"); // Declarando Archivo a leer.
var writableStream = fs.createWriteStream("toShopify.csv"); // Declarando Archivo a crear y escribir.
// Stream Delcarations
var csvStream = csv.createWriteStream({headers: true}); // Creando flujo de datos y activando encabezado de columnas.
csvStream.pipe(writableStream); // Apropiando flujo de datos con objecto a escribir.
csv.fromStream(stream, {ignoreEmpty: true}) //leyendo del flujo de entrada.
.on("data", function(data){ // en linea leida.
csvStream.write({ // escribiendo nuevo linea en.
{"processors":{}}
@navio
navio / index.html
Last active March 12, 2018 03:14
Example of D3
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<script src="https://d3js.org/d3.v4.min.js"></script>
<body> </body>
</html>
@navio
navio / fetchPostForm.js
Last active August 12, 2023 02:38
Fetch Example application/x-www-form
let customSearch = (params) => {
let url = '/contentlicenseajax';
let body = Object.keys(params)
.map((key) => { return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]); })
.join('&');
return fetch('/contentlicenseajax', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
credentials: 'include',
body: body
@navio
navio / jsonFetch
Created January 20, 2018 03:52
Fetch Async Method
export default async (url,method,json) => {
if(typeof method !== 'string' ) return fetch(url,fetch);
let response = await fetch(url,{
method,
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json'
},
body: JSON.stringify(json)
}).then(x=>x.json());
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<audio controls id="audio"></audio>
<script>
if(Hls.isSupported()) {
var audio = document.getElementById('audio');
var hls = new Hls();
hls.loadSource('https://audiblecdn-vh.akamaihd.net/i/295896/audiblewords/content/bk/haki/001104/V$342634$V/aax/bk_haki_001104_22_32.mp4/master.m3u8?hdnea=st=1503521904~exp=1534971504~acl=/*~hmac=117a6ae0ff4697bb30d006930858dfe5b64330eb61a30e9eda59580f8e5b8443');
hls.attachMedia(audio);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();