Skip to content

Instantly share code, notes, and snippets.

View HabeebCycle's full-sized avatar

Habeeb Okunade HabeebCycle

View GitHub Profile
@HabeebCycle
HabeebCycle / big-o-java-collections.md
Created February 6, 2019 03:26 — forked from FedericoPonzi/big-o-java-collections.md
Big O notation for java's collections

The book Java Generics and Collections has this information (pages: 188, 211, 222, 240).

List implementations:

                      get  add  contains next remove(0) iterator.remove
ArrayList             O(1) O(1) O(n)     O(1) O(n)      O(n)
LinkedList O(n) O(1) O(n) O(1) O(1) O(1)
@HabeebCycle
HabeebCycle / clean_code.md
Created March 12, 2020 11:50 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@HabeebCycle
HabeebCycle / node_nginx_ssl.md
Created September 20, 2020 12:58 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@HabeebCycle
HabeebCycle / docker_wordpress.md
Created September 23, 2020 13:39 — forked from bradtraversy/docker_wordpress.md
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@HabeebCycle
HabeebCycle / application.yaml
Created January 22, 2021 02:48
reactive-api-redis-demo
spring:
application:
name: Spring-Reactive-Data-Redis
# Redis DB configuration
redis:
host: localhost
port: 6379
database: 0
password: 50M3*S3cured*Pa55W0rd
@HabeebCycle
HabeebCycle / pom.xml
Last active January 22, 2021 03:02
Reactive Api with Reactive Redis
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@HabeebCycle
HabeebCycle / User.java
Last active January 22, 2021 05:34
User entity object
package com.habeebcycle.demo.api.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
import java.io.Serializable;
public class User implements Serializable {
@Id
package com.habeebcycle.demo.api.config;
import com.habeebcycle.demo.api.model.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.ReactiveRedisOperations;
import org.springframework.data.redis.core.ReactiveRedisTemplate;