This file contains 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 WebSocketServer = require('ws').Server; | |
const express = require('express'); | |
const path = require('path'); | |
const server = require('http').createServer(); | |
const PubSubManager = require('./pubsub'); | |
const app = express(); | |
const pubSubManager = new PubSubManager(); | |
app.use(express.static(path.join(__dirname, '/public'))); |
This file contains 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
class PubSubManager { | |
constructor() { | |
this.channels = { | |
weather: { | |
message: '', | |
subscribers: [] | |
}, | |
sports: { | |
message: '', | |
subscribers: [] |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
font-family: Tahoma, Geneva, sans-serif; | |
} | |
div { |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
font-family: Tahoma, Geneva, sans-serif; | |
} | |
div { |
This file contains 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
npm init | |
npm install --save-dev @babel/core @babel/node @babel/preset-env | |
npx babel-node index.js --presets=@babel/preset-env |
This file contains 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 users = [ | |
{ | |
name: { | |
first: 'John', | |
last: 'Galt' | |
}, | |
email: '[email protected]', | |
age: 30 | |
}, | |
{ |
This file contains 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 users = [ | |
{ | |
name: { | |
first: 'John', | |
last: 'Galt' | |
}, | |
email: '[email protected]', | |
age: 30 | |
}, | |
{ |
This file contains 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
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/ioctl.h> | |
#define DIGITS 10 | |
#define LETTERS 26 | |
void nullify(int arr[], int size); | |
void histogram(int arr[], int size, int start, int terminalWidth); | |
int getTermWidth(); |
This file contains 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 React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
const propTypes = { | |
text: PropTypes.string.isRequired, | |
customClass: PropTypes.string, | |
selectionHandler: PropTypes.func | |
}; | |
/** |