Skip to content

Instantly share code, notes, and snippets.

View simply-alliv's full-sized avatar
🏠
Working from home

Allistair Vilakazi simply-alliv

🏠
Working from home
View GitHub Profile
module.exports = {
...
parser: '@typescript-eslint/parser', // This is the parser we will use
...
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:@typescript-eslint/recommended', // This is the plugin we add
],
...
@simply-alliv
simply-alliv / .prettierignore
Created October 18, 2019 20:04
Standard Prettier ignore file for an Ember Octane App
# See https://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist/
/tmp/
# dependencies
/bower_components/
/node_modules/
@simply-alliv
simply-alliv / .eslintrc.js
Created October 18, 2019 20:40
Standard Prettier plugin and rules for an Ember Octane App
module.exports = {
...
plugins: ['ember', 'prettier'], // Add Prettier to our plugins
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended' // This is the plugin we add
],
...
@simply-alliv
simply-alliv / .prettierrc.js
Created October 18, 2019 20:43
Prettier configuration file that enforces the use of single quotes
/* eslint-disable no-undef */
module.exports = {
singleQuote: true
};
@simply-alliv
simply-alliv / settings.json
Created October 18, 2019 20:58
Standard settings of Prettier and ESLint for VSCode. Ember App configuration.
{
"files.eol": "\n",
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
@simply-alliv
simply-alliv / speakeasy-generate-secret.ts
Created July 23, 2020 00:06
A function that. using the speakeasy package, generates a base32 secret with a one-time password authentication URL.
/**
* ... Some lines omitted for brevity.
*/
import * as speakeasy from 'speakeasy';
class AuthenticationService {
...
public getTwoFactorAuthenticationCode() {
@simply-alliv
simply-alliv / qrcode.ts
Created July 23, 2020 00:09
A function that returns a QR code, using the qrcode package.
/**
* ... Some lines omitted for brevity.
*/
import * as QRCode from 'qrcode';
class AuthenticationService {
...
public async respondWithQRCode(data: string, response: Response) {
QRCode.toFileStream(response, data);
/**
* Code removed for brevity.
*/
import Paseto from 'paseto.js';
class AuthenticationService {
...
public async register(userData: CreateUserDto) {