Skip to content

Instantly share code, notes, and snippets.

View fijiwebdesign's full-sized avatar

Gabirieli Lalasava fijiwebdesign

View GitHub Profile
@fijiwebdesign
fijiwebdesign / example.js
Created June 24, 2021 17:09
Query selector that selects all elements including those in ShadowDOM
document.body.querySelectorAll('.button') // only buttons not in shadow dom
$query('.button') // all .button including those in shadow dom
{
"source": "xe.com",
"currency-symbol": {
"count": "115",
"entry": [
{
"code": "EUR",
"unicode-decimal": "8364",
"unicode-hex": "20ac",
"text": "Euro Member Countries"
@fijiwebdesign
fijiwebdesign / node-browser-whatwg-streams.js
Last active September 10, 2018 14:09
Reading and converting between node and browser whatwg streams
/***
* Node streams - https://nodejs.org/api/stream.html
* WhatWG Streams - https://github.com/whatwg/streams
*/
/**
* Read from a WhatWG Stream
* @param {Stream} WhatWG stream
* @param {function} onData
@fijiwebdesign
fijiwebdesign / install_elasticsearch_osx.md
Last active August 7, 2018 07:51 — forked from djonsson/install_elasticsearch_osx.md
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@fijiwebdesign
fijiwebdesign / PromiseEmitter.js
Last active April 15, 2018 20:24
Emit promises in place of events
/**
* Emit a promise once in place of event with timeout
* @param {EventEmitter} emitter
*/
function PromiseEmitter(emitter) {
this.emitter = emitter;
}
PromiseEmitter.prototype.once = function once(event) {
let timer;
@fijiwebdesign
fijiwebdesign / find-git-reps.sh
Created March 31, 2018 02:32
Find all git repositories
#!/bin/bash
find . -type d -name .git | xargs -I{} git --git-dir={} remote -v
native-stream.js uses the reference implementation, compiled with babel to run
on latest io.js.
stream-bluebird.js is exactly the same as native-stream.js except it uses the
latest bluebird Promise implementation.
node-stream.js uses the node stream implementation and forced to be async by
using process.nextTick() (which is functionally equivalent to the microtask
processor)
@fijiwebdesign
fijiwebdesign / test-internet-connection.js
Created November 20, 2017 10:57
Test if we have an internet connection with JS
function testConnection() {
var url = location.href.match(/^https?\:/i) ? '/' : 'https://google.com'
var rand = parseInt(Math.ceil(Math.random()*Math.pow(10, 14))).toString(16)
var retry = ms => setTimeout(() => testConnection(), ms || 5000)
var notify = msg => document.body.innerHTML = `<h1 style="font-size:300%;position:fixed;top:40%;width:100%;text-align:center;">${msg}</h1>`
var handleResp = (err, msg) => {
console.log(err, new Date, msg)
notify(msg)
retry()
}
@fijiwebdesign
fijiwebdesign / torcdn-embed-viewer.html
Last active December 24, 2017 06:07
TorCDN embed code for broadcast viewer
<!--
Usage:
Replace the {uid} with a unique ID of the broadcaster.
All broadcasts are public at this time. So anyone with the UID of a broadcaster can view the video stream.
Example: