Skip to content

Instantly share code, notes, and snippets.

View shierro's full-sized avatar
🏠
Working from home

Theo shierro

🏠
Working from home
View GitHub Profile
@shierro
shierro / config.js
Created February 3, 2018 00:36
Jitsi Web UI config
var config = {
hosts: {
domain: 'prosody',
muc: 'conference.prosody', // FIXME: use XEP-0030
focus: 'focus.prosody',
},
disableSimulcast: false,
resolution: 720,
externalConnectUrl: '//localhost/http-pre-bind',
// analyticsScriptUrl: "https://meet.jit.si/libs/jitsi-analytics-web-client.min.js",
@shierro
shierro / config.js
Created February 3, 2018 00:39
Version 1 Jitsi config
/* jshint maxlen:false */
var config = { // eslint-disable-line no-unused-vars
// configLocation: './config.json', // see ./modules/HttpConfigFetch.js
hosts: {
domain: 'prosody',
bridge: 'videobridge.prosody',
anonymousdomain: 'guest.prosody',
authdomain: 'prosody', // defaults to <domain>
muc: 'conference.prosody', // FIXME: use XEP-0030
sudo apt-get install libcap2-bin
sudo setcap 'cap_net_bind_service=+ep' $(readlink -f $(which node))
@shierro
shierro / routes.js
Created May 8, 2018 00:15
Example routing using expressJS router
const express = require('express');
const statusMonitor = require('express-status-monitor')({ path: '' });
const healthcheck = require('express-healthcheck');
const versionCheck = require('version-healthcheck');
const swaggerUi = require('swagger-ui-express');
const ErrorController = require('./controllers/ErrorController');
const SfdcController = require('./controllers/SalesforceController');
const swaggerDocument = require('../swagger.json');
const authService = require('./services/authService');
/* eslint-disable */
const VerifySingleton = {
sleep (ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
async testFunc() {
return Promise.reject({
statusCode: 500,
errorCode,
@shierro
shierro / main.js
Created June 28, 2018 13:36
main.js
const {
VerifySingleton,
VerifyFactory,
} = require('./verify');
const factory = new VerifyFactory();
const run = async () => {
try {
@shierro
shierro / express.js
Created June 28, 2018 13:38
express.js
const UserController = {
get(req, res, next) {
try {
new Promise(resolve => setTimeout(() => resolve({ success: true }), 5000))
.then(res.json)
.catch(res.json);
} catch (e) {
next(e);
}
},
@shierro
shierro / serverless.yaml
Created August 11, 2018 11:47
serverless CORS
functions:
my_func:
handler: handler.my_func
events:
- http:
path: my_func
method: get
cors: true
import UserConnector from './user'
import sinon from 'sinon'
import mongoose from 'mongoose'
import UserModel from '../../models/user'
describe("User connector", () => {
it("should register user", async () => {
const expectedUser = {
onSaveClicked = () => {
const options = {
crossDomain: true,
credentials: 'include',
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: {
filename: this.state.name