Skip to content

Instantly share code, notes, and snippets.

View hugomd's full-sized avatar
:bowtie:

Hugo hugomd

:bowtie:
View GitHub Profile
const main = async () => {
try {
// Initialise prompt with an empty message
+ prompt.start();
+ prompt.message = '';
// Turn prompt.get() into a promise
+ const get = util.promisify(prompt.get);
// Create a schema to validate user input
const { ChatManager, TokenProvider } = require('@pusher/chatkit')
const { JSDOM } = require('jsdom')
const util = require('util')
+ const prompt = require('prompt')
...
const {ChatManager, TokenProvider} = require('@pusher/chatkit');
const {JSDOM} = require('jsdom');
const util = require('util');
const makeChatkitNodeCompatible = () => {
const {window} = new JSDOM();
global.window = window;
global.navigator = {};
};
@hugomd
hugomd / server.js
Last active December 8, 2019 09:41
Chatkit authentication server
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const Chatkit = require("@pusher/chatkit-server");
const app = express();
const chatkit = new Chatkit.default({
instanceLocator: "YOUR_INSTANCE_LOCATOR",
key: "YOUR_KEY"
FROM nginx:latest
COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ./about.json /var/www/about.json
EXPOSE 80
image: my.registry/hugo/now-image:latest
stages:
- review
variables:
REPO_NAME: now-review-app
start_review:
stage: review
image: docker:latest
variables:
DOCKER_DRIVER: overlay
services:
- docker:dind
stages:
- push
FROM node:alpine
RUN npm install -g --silent --unsafe-perm now
image: node
stages:
- review
variables:
REPO_NAME: now-review-app
start_review:
stage: review
@hugomd
hugomd / keyrepeat.shell
Created February 13, 2017 03:42 — forked from rastasheep/keyrepeat.shell
Enable key repeat in Apple Lion for Atom in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Atom if you're running vim mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.