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
// https://github.com/ChromeDevTools/devtools-frontend/blob/0dc36933e485a7009c380f41564848d70cafb429/front_end/models/text_utils/TextUtils.ts#L336 | |
export function isMinified(text) { | |
const kMaxNonMinifiedLength = 500; | |
let linesToCheck = 10; | |
let lastPosition = 0; | |
do { | |
let eolIndex = text.indexOf('\n', lastPosition); | |
if (eolIndex < 0) { | |
eolIndex = text.length; |
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
// | |
// This scipts allows to import Egghead course as TODO to Habitica | |
// | |
// Step 1: Replace `apiKey` and `userId` with yours (check profile settings on Habitica) | |
// Step 2: Type resource name (egghead/vuemaster/frontendmaster/pluralsight/freecodecamp) in last line of the script | |
// Step 3: Open desired course in browser | |
// Step 4: Open DevTool and execute script in console | |
// Step 5: Check Habitica: new ToDo should be there :) | |
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 |
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
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
'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 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
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
{ | |
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
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; |
NewerOlder