Skip to content

Instantly share code, notes, and snippets.

@ilfroloff
ilfroloff / gist:6589031198df242081141f50c17236ec
Created May 9, 2017 12:43
Self-signed SSL Certificates for Node.js HTTPS servers

PFX

Simple PFX generation (source)

openssl genrsa 2048 > private.pem
openssl req -x509 -new -key private.pem -out public.pem # fill options
openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx
const ABORTABLE_ERROR_KEY = '__abortablePromise';
/**
* @typedef {Promise.<*>} AbortablePromise
*
* @property {function} abort Additional method for abort original promise
*/
/**
*
@ilfroloff
ilfroloff / README.md
Last active February 12, 2017 21:41
My Node.JS Style Guide

My Node.JS Style Guide

Main rules of a node.js code-writing

Keywords var, let, const

  • const: use everywhere except loops and reassigning variables
  • let: only in loops or redefined variables
  • var: don't use
@ilfroloff
ilfroloff / README.md
Last active January 25, 2017 11:25
Wrap you Node.js project code by "use strict"

##What is

Redefine global module with "use strict" wrapper for own code. This module doesn't touch node_modules code, because node_modules can be didn't compatibilite with "use strict" requirements

How to test:

node start_point.js

it show in console appear "It works!" (this message prints by my_own_code.js file)

@ilfroloff
ilfroloff / ClassA.js
Last active March 4, 2024 09:01
JavaScript Singleton using class
'use strict';
import Singleton from 'Singleton';
class ClassA extends Singleton {
constructor() {
super();
}
singletonMethod1() {
// ...