This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
install(){ | |
isApt=`command -v apt-get` | |
isYum=`command -v yum` | |
package=$1 | |
if [ -n "$isApt" ]; then | |
apt-get -y install $package | |
elif [ -n "$isYum" ]; then | |
yum -y install $package |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PHPFireStore { | |
class FireStoreDocument { | |
private $fields = []; | |
private $name = null; | |
private $createTime = null; | |
private $updateTime = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let request = require('request'); | |
let validUrl = require('valid-url'); | |
class PubSub { | |
protected subscribers: { [key: string]: Function } = {}; | |
public subscribe(callback: Function): string { | |
let key: string = Date.now() + '_' + Math.ceil(Math.random() * 10000); | |
this.subscribers[key] = callback; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const countriesArray = [ | |
{ name: "Aruba", value: "ABW" }, | |
{ name: "Afghanistan", value: "AFG" }, | |
{ name: "Angola", value: "AGO" }, | |
{ name: "Anguilla", value: "AIA" }, | |
{ name: "Åland Islands", value: "ALA" }, | |
{ name: "Albania", value: "ALB" }, | |
{ name: "Andorra", value: "AND" }, | |
{ name: "Netherlands Antilles", value: "ANT" }, | |
{ name: "United Arab Emirates", value: "ARE" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Work in progress to convert this to TypeScript/Node: | |
// https://gist.github.com/biomancer/8d139177f520b9dd3495 | |
import { exec } from "child_process"; | |
/** | |
* | |
*/ | |
export class IframeByteRange { | |
public packetTime: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Flagpole } = require('flagpole'); | |
const suite = Flagpole.Suite('iTunes API Test') | |
.base('https://itunes.apple.com'); | |
suite.Scenario('Music Videos Search') | |
.open('/search?term=2pac&entity=musicVideo') | |
.json() | |
.assertions(function (response) { | |
let firstResult = response.select('results').first(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Firebase Functions messes with your request and will wreck your day because none of the | |
* traditional upload handlers with Express will work. | |
* | |
* Credit: https://stackoverflow.com/questions/47242340/how-to-perform-an-http-file-upload-using-express-on-cloud-functions-for-firebase | |
*/ | |
const Busboy = require('busboy'); | |
const allowedMethods: string[] = ['POST', 'PUT']; | |
export class FileUpload { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isFunction } from 'util'; | |
abstract class Listener { | |
protected listeners: { [eventName: string]: [Function] } = {}; | |
public on(eventName: string, callback: Function) { | |
this.listeners[eventName] = this.listeners[eventName] || []; | |
this.listeners[eventName].push(callback); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let counter = 0; | |
exports.handler = async (event) => { | |
counter++; | |
return { | |
statusCode: 200, | |
body: JSON.stringify(counter), | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HLS = require('hls-parser'); | |
const request = require('request'); | |
const URL = require('url').URL | |
// Error codes | |
const ERROR = { | |
INVALID_PLAYLIST_URL: { | |
code: 100, | |
message: 'Invalid playlist URL' | |
}, |