Open 2 browsers and paste this code to the console
const peerConnection = new RTCPeerConnection();
peerConnection.onicecandidate = (e) => {
console.log("Peer A onicecandidate", peerConnection.localDescription);
};
'use strict'; | |
const crypto = require('crypto'); | |
const AES_METHOD = 'aes-256-cbc'; | |
const IV_LENGTH = 16; // For AES, this is always 16, checked with php | |
const password = 'lbwyBzfgzUIvXZFShJuikaWvLJhIVq36'; // Must be 256 bytes (32 characters) | |
function encrypt(text, password) { |
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
// src/api/index.js | |
import express from 'express'; | |
const uploadDir = 'static'; | |
export default () => { | |
const router = express.Router(); | |
router.use(`/${uploadDir}`, express.static(uploadDir)); |
#!/bin/bash | |
# Creator: Phil Cook | |
# Modified: Andy Miller | |
osx_major_version=$(sw_vers -productVersion | cut -d. -f1) | |
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2) | |
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3) | |
osx_patch_version=${osx_patch_version:-0} | |
osx_version=$((${osx_major_version} * 10000 + ${osx_minor_version} * 100 + ${osx_patch_version})) | |
homebrew_path=$(brew --prefix) | |
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g') |
.container { | |
margin: 0 auto; | |
max-width: 980px; | |
min-width: 320px; | |
} | |
.row { | |
display: flex; | |
flex-wrap: wrap; | |
} |
class Client { | |
static _instance | |
static defaultHeaders = { 'Content-Type': 'application/json' } | |
config = { | |
baseUrl: '', | |
urlHandler: (baseUrl, uri, query) => { | |
var url = `${baseUrl}${uri}` | |
if (uri.includes('://')) { | |
url = uri |
const replacePlaceholder = (template, data) => { | |
try { | |
return template.replace(/{(\w+)}/g, (keyVariable, keyData) => | |
data.hasOwnProperty(keyData) ? data[keyData] : variable | |
); | |
} catch (error) { | |
console.error('replacePlaceholder', error); | |
throw error; | |
} | |
}; |
export const encode = (str) => | |
btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(/\=+$/, ''); | |
export const decode = (str) => { | |
if (str.length % 4 != 0) { | |
str += '==='.slice(0, 4 - (str.length % 4)); | |
} | |
return atob(str.replace(/-/g, '+').replace(/_/g, '/'), 'base64'); | |
}; |