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
"use strict"; | |
const LEFT = 'left'; | |
const RIGHT = 'right'; | |
/** | |
* Calculates sign based on direction | |
* @param {string} direction | |
* @returns {Number} | |
*/ |
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
export function isAlphaNumeric( value ) { | |
return /^[a-zA-Z0-9]+$/.test(value) | |
} |
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
it('Should return true for correct ipv4', () => { | |
let correctIps = [ | |
'0.0.0.0/0', | |
'255.255.255.255/32', | |
'159.12.101.0/24' | |
]; | |
let expected = {} | |
correctIps.map(ip => { | |
actual[ip] = true; |
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
{ | |
IPv4: /^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/ | |
IPv6:/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i, | |
} |
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 HapiSwagger = require('hapi-swagger'); | |
const config = require('../utils/config'); | |
const swaggerOptions = { | |
basePath : `/api/${config.service.apiversion}/`, | |
jsonEditor : true, | |
documentationPath : '/api/docs', | |
swaggerUIPath : '/api/docs/swaggerui/', | |
jsonPath : '/api/docs/swagger.json', | |
securityDefinitions: { |
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 acorn = require("acorn") | |
const walk = require("acorn/dist/walk") | |
var getTarget = function (field, st, cb) { | |
// next lets see its an identifier, if so, its right on one of the state objects | |
var isId = field.type == 'Identifier'; | |
var name = field.name; | |
var value, obj, prop; |
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
'use strict'; | |
const app = require('express')(); | |
const http = require('http').Server(app); | |
const io = require('socket.io')(http, { serveClient: false }); | |
const middleware = require('socketio-wildcard')(); | |
io.use(middleware); | |
app.use((req, res, next) => { |
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 express = require('express'); | |
const app = express(); | |
const server = require('http').Server(app); | |
const io = require('socket.io')(server); | |
server.listen(3000); | |
io.on('connection', function(socket){ | |
console.log("---------------------------------------------------------") | |
console.log('An user connected'); |
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
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<match> | |
<test name="family"><string>monospace</string></test> | |
<edit name="family" mode="prepend" binding="weak"> | |
<string>Noto Color Emoji</string> | |
</edit> | |
</match> | |
<match> |
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 makeReactive from './makeReactive'; | |
let data = { | |
data: { | |
price: 5, | |
quantity: 2 | |
}, | |
computed: { | |
total() { | |
return this.price * this.quantity |