Skip to content

Instantly share code, notes, and snippets.

View YanLobat's full-sized avatar

Yan YanLobat

  • Portugal, Lisboa
View GitHub Profile
const settings = [
{
name: 'gameManager',
settings: {
id: 1,
escape_rooms_id: 1,
silent : true
},
},
{
const fs = require('fs');
const crypto = require('crypto');
const secret = 'windranger';
let blocks, block, hash, content;
if (fs.existsSync('./blocks.txt')) {
blocks = JSON.parse(fs.readFileSync('./blocks.txt'));
const blocksAmount = blocks.length;
for (let i = 0; i < blocksAmount; i++) {
const net = require('net');
let port = 3000;
let isRoot = false;
const connectionList = new Map();
const expireDelta = 5*60*1000;
const server = net.createServer(socket => {
socket.on('error', err => {
console.log(err);
function checkWord( board, word ) {
const graph = board.map((row, rowNumber) => {
return row.map((letter, position) => {
return {
name: letter,
neighbours: getNeighbours(rowNumber, position, board),
index: rowNumber * board.length + position
};
});
});
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: "./js/index.js",
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist')
},
module: {
'use strict';
function embedNodeResolver(jsonLD) {
let IDindex = {};
let suspectedNodes = {};
let markedShapes = [];
jsonLD.shapes.forEach((shape, index) => {
IDindex[shape['@id']] = index; //write down the node to check it in future
let suspectedNode = suspectedNodes[shape['@id']]
if (suspectedNode !== undefined) {
function embedNodeResolver(jsonLD) {
jsonLD.shapes.forEach((shape, index) => {
IDindex[shape['@id']] = index; //write down the node to check it in future
let suspectedNode = suspectedNodes[shape['@id']]
if (suspectedNode !== undefined) {
jsonLD.shapes[suspectedNode['shapeIndex']]['property'][suspectedNode['propertyIndex']]['node'] = shape;
markedShapes.push(index);
}
shape.property.forEach((property, i) => {
if (property.node !== undefined) {
@YanLobat
YanLobat / server.js
Created September 26, 2016 20:24
config test
import webpack from 'webpack';
import config from './webpack.config.js';
import WebpackDevServer from 'webpack-dev-server';
const PROD = process.env.npm_config_argv.includes('--production');
config.entry.app.unshift('webpack-dev-server/client?http://localhost:9001', 'webpack/hot/only-dev-server');
var compiler = webpack(config);
const server = new WebpackDevServer(compiler, {
@YanLobat
YanLobat / index.js
Last active September 24, 2016 13:56
FloodDepth solution
function solution(A) {
let start = A[0];
let depth = 0;
let result = 0;
let min = 100000000;
for (let i = 1; i < A.length; i++) {
if (A[i] < start) {
if ((A[i] - min) > depth) {
depth = A[i] - min;
}