Skip to content

Instantly share code, notes, and snippets.

View johannesMatevosyan's full-sized avatar

Hovhannes Matevosyan johannesMatevosyan

  • Yerevan, Armenia
View GitHub Profile
@johannesMatevosyan
johannesMatevosyan / server.js
Last active May 8, 2023 10:08
Websockets: send message to all clients except sender.
var http = require('http');
var Static = require('node-static');
var WebSocketServer = new require('ws');
// list of users
var CLIENTS=[];
var id;
// web server is using 8081 port
var webSocketServer = new WebSocketServer.Server({ port: 8081 });
@johannesMatevosyan
johannesMatevosyan / chat.js
Created February 14, 2016 11:24
socket.io - keep track of clients
// client side code
var socket = io.connect('http://localhost:3000/');
var chatInfra = io.connect('http://localhost:3000/chat_infra'),
chatCom = io.connect('http://localhost:3000/chat_com');
chatInfra.on('name_set', function (data) {
chatInfra.on("user_entered", function (user) {
$('#messages').append('<div class="systemMessage">' + user.name + ' has joined the room.' + '</div>');
});
@johannesMatevosyan
johannesMatevosyan / client.js
Last active July 16, 2019 07:29
File sharing with WebRTC
// Set up connection between users.
var name, connectedUser;
var connection = new WebSocket('ws://127.0.0.1:8081');
connection.onopen = function () {
console.log("Connected");
};
// Handle all messages through this callback
connection.onmessage = function (message) {
@johannesMatevosyan
johannesMatevosyan / index.html
Created January 13, 2016 14:37
Creating RTCPeerConnection
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Creating RTCPeerConnection</title>
<style>
body {
background-color: #3D6DF2;
margin-top: 15px;
}
@johannesMatevosyan
johannesMatevosyan / phones.json
Created September 28, 2015 15:09
A list of all countries and their codes in json format
{
"countries": [
{
"code": "+7 840",
"name": "Abkhazia"
},
{
"code": "+93",
"name": "Afghanistan"
},
@johannesMatevosyan
johannesMatevosyan / countries.json
Created September 28, 2015 14:56
A List of all countries and codes in json format
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Aland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "Andorra", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
h1: 2em - 32px
h2: 1.5em - 24px
h3: 1.17em - ~18px
h4: 1em - 16px
h5: 0.83em - 13px
h6: 0.75em - 12px