Skip to content

Instantly share code, notes, and snippets.

View adegbengaagoro's full-sized avatar

Agoro, Adegbenga. B adegbengaagoro

View GitHub Profile
@adegbengaagoro
adegbengaagoro / Secure Development Principles.md
Last active January 27, 2023 03:47
A guide on some security focused practices and principles when building software

Secure Design Principles

Defense in Depth

Also known as layered defense, defense in depth is a security principle where single points of complete compromise are eliminated or mitigated by the incorporation of a series or multiple layers of security safeguards and risk-mitigation countermeasures.

Have diverse defensive strategies, so that if one layer of defense turns out to be inadequate, another layer of defense will hopefully prevent a full breach.

Fail Safe

A security principle that aims to maintain confidentiality, integrity and availability by defaulting to a secure state, rapidly recovering software resiliency upon design or implementation failure. In the context of software security, fail secure is commonly used interchangeably with fail safe, which comes from physical security terminology.

@adegbengaagoro
adegbengaagoro / flutterGetterConversion.dart
Last active August 3, 2022 12:33
Convert makeMangoShake method to a fat arrow function
class Recipe {
int mango;
int milk;
int sugar;
Recipe(this.mango, this.milk, this.sugar);
int makeMangoShake() {
return mango+milk+sugar;
}
@adegbengaagoro
adegbengaagoro / SonarLint-Rules.md
Last active August 3, 2022 09:32
Sonarlint rules to be enabled in VSCode

Important SonarLint Rules for JavaScript Development in Crenet

This rules should be enabled in your VSCode Settings (JSON view). Just replace the object you find in your settings with the object below

"sonarlint.rules": {
	
		"Web:BoldAndItalicTagsCheck": {
			"level": "off"
		},
@adegbengaagoro
adegbengaagoro / Crenet-Software-Development-Framework.md
Last active June 20, 2023 14:30
Development Framework to guide our engineering processes and outcomes

Framework Coverage

General Concepts

  • Endpoint URL Definition
  • Postman API Documentation
  • Issue tracking via Github Issues
  • Git Methodologies
    • Frequent small commits
    • Push task to branch whether complete or incomplete at end of day
  • Single issue per Gitflow feature branch
@adegbengaagoro
adegbengaagoro / Service-Class-Structure.md
Last active August 3, 2022 09:38
How to structure the Service Classes to be used in the MVCS pattern

Service Class Structure

The idea is to have a set of consistent methods that are exposed from the service, the service is a class with static methods.

Generic Methods

getXById
getXByIdentifier
getXBySlug
getX
@adegbengaagoro
adegbengaagoro / SettingsCitiesSeeder.ts
Created April 25, 2022 10:40
Country, State and Cities Seeder - Nigeria focused for AdonisJS
import BaseSeeder from '@ioc:Adonis/Lucid/Seeder'
import Database from '@ioc:Adonis/Lucid/Database'
import SettingsCity from 'App/Models/SettingsCity'
export default class SettingsCitiesSeeder extends BaseSeeder {
public async run() {
const citiesData = [
{
city_label: 'Agege LGA',
state_id: 25,
@adegbengaagoro
adegbengaagoro / routes.ts
Created February 10, 2022 02:07
Content Negotiation - Official AdonisJS Example
Route.get('posts', async ({ request, view }) => {
const posts = [
{
title: 'Adonis 101',
},
]
switch (request.accepts(['html', 'json'])) {
case 'html':
return view.render('posts/index', { posts })
@adegbengaagoro
adegbengaagoro / viewAndApiOutputInterfaces.ts
Last active February 10, 2022 02:29
Content Negotiation Example - viewAndApiOutputHelper Function
export interface ViewDataPayloadStructure {
viewTemplate: string
outputData: object
}
export interface ApiDataPayloadStructure {
statusCode: number
statusMessage: string
responseMessage: string
outputData: object
@adegbengaagoro
adegbengaagoro / viewAndApiOutputHelper.ts
Last active February 10, 2022 02:30
Content Negotiation Example - viewAndApiOutputHelper Function
import View from "@ioc:Adonis/Core/View"
import {
ApiDataPayloadStructure,
OutputTypeStructure,
ViewDataPayloadStructure
} from "App/Interfaces/viewAndApiOutputInterfaces"
function viewAndApiOutputHelper(outputType: OutputTypeStructure, viewDataPayload: ViewDataPayloadStructure, apiDataPayload: ApiDataPayloadStructure) {
if (outputType === 'html') {
return View.render(viewDataPayload.viewTemplate, viewDataPayload.outputData)
@adegbengaagoro
adegbengaagoro / payloadGeneratorForViewAndApi.ts
Last active February 10, 2022 02:32
Content Negotiation Example - payloadGeneratorForViewAndApi Function
function payloadGeneratorForViewAndApi(data: object | any[], viewTemplate: string, apiResponseMessage: string) {
const viewDataPayload = {
viewTemplate: viewTemplate,
outputData: { data }
}
const apiDataPayload = {
statusCode: 200,
statusMessage: 'Success',
responseMessage: apiResponseMessage,