Skip to content

Instantly share code, notes, and snippets.

View eamon0989's full-sized avatar

Eamon eamon0989

View GitHub Profile
@eamon0989
eamon0989 / gist:0685dfdf8f663b0ee633e1e58937b860
Created May 12, 2022 05:46
Validate Certificate Node-Red flow
[
{
"id": "26f6e289b3fab452",
"type": "tab",
"label": "Validate Certificate",
"disabled": false,
"info": "",
"env": []
},
{
GET / HTTP/1.1
Host: www.google.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
let name = 'Eamon';
function printName() {
console.log(name);
}
printName(); // => 'Eamon'
name = 'Jack';
printName(); // => 'Jack'
class Grandfather {
constructor(name, age, job) {
this.name = name;
this.age = age;
this.job = job;
}
aboutMe() {
console.log(`I'm ${this.name}, I'm ${this.age} years old and I'm ${this.job === 'retired' ? '' : 'a '}${this.job}.`);
}
function Grandfather(name, age, job) {
this.name = name;
this.age = age;
this.job = job;
}
Grandfather.prototype.aboutMe = function() {
console.log(`I'm ${this.name}, I'm ${this.age} years old and I'm ${this.job === 'retired' ? '' : 'a '}${this.job}.`);
};
function objectFactory() {
return {
property1: 'My first property',
property2: 'My second property',
printProperties() {
for (let prop in this) {
if (typeof this[prop] !== 'function') {
console.log(`${prop}: ${this[prop]}`);
}
// This is a continuation of the previous code block
Object.prototype.test = `I'm a property of Object.prototype`;
console.log(Object.prototype); // [Object: null prototype]
// { test: "I'm a property of Object.prototype" } */
console.log(Factory.prototype.test); // I'm a property of Object.prototype
console.log(Factory.prototype); // {}
console.log(descendant.test); // I'm a property of Object.prototype
function Factory() {
this.foo = 1;
this.bar = 'string';
}
let descendant = new Factory();
console.log(Factory.prototype); // {}
console.log(Object.getPrototypeOf(Factory.prototype)); // [Object: null prototype] {}
function Factory() {
this.foo = 1;
this.bar = 'string';
}
Factory.prototype.example = "I'm a property of Factory.prototype";
console.log(Factory.prototype); // { example: "I'm a property of Factory.prototype" }
let descendant = new Factory();
console.log(descendant); // Factory { foo: 1, bar: 'string' }
function Factory() {
this.foo = 1;
this.bar = 'string';
}
let descendant = new Factory();
console.log(descendant); // Factory { foo: 1, bar: 'string' }
console.log(Factory.prototype); // {}