Skip to content

Instantly share code, notes, and snippets.

View devqx's full-sized avatar
🎯
Focusing

Paul Oluwaseun devqx

🎯
Focusing
View GitHub Profile
@devqx
devqx / async.js
Created July 18, 2019 14:45 — forked from bschwartz757/async.js
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@devqx
devqx / Proxy.js
Created January 22, 2019 20:10 — forked from ryandabler/Proxy.js
Complete example of proxying an array for this article: https://itnext.io/meta-programming-in-javascript-with-proxies-64fa4898070e
const db = [
{
name: 'John Doe',
age: 28,
lastModified: Date.now(),
lastAccessed: Date.now()
},
{
name: 'Jane Smith',
age: 30,
@devqx
devqx / introrx.md
Created October 24, 2017 08:00 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@devqx
devqx / gist:f314ddb6254f478b7e0bcb97a0ee2897
Created September 12, 2017 15:44 — forked from PhilKershaw/gist:1389041
Simple code for executing commands on a remote Linux server via SSH in PHP
<?php
/**
* Simple code for executing commands on a remote Linux server via SSH in PHP
*
* @author Phil Kershaw (In collaboration with Philip Mott)
*
* Note: ssh2_connect requires libssh2-php which is a non-standard PHP lib.
* Debian: apt-get install libssh2-php
* Redhat: yum install libssh2-php ???? I've no idea for redhat, sorry.
*/