Skip to content

Instantly share code, notes, and snippets.

View joelethan's full-sized avatar

Katusiime Joel Ian joelethan

  • Honey Comb Technologies (ACMIS)
  • Kampala, Uganda
  • X @joelethan
View GitHub Profile
DOM Manipulation session 1
@joelethan
joelethan / diagonalDifference.js
Created January 26, 2022 10:25
Given a square matrix, calculate the absolute difference between the sums of its diagonals.
function diagonalDifference(arr) {
// Write your code here
{
// Initialize sums of diagonals
let d1 = 0, d2 = 0;
const n = arr[0].length;
for (let i = 0; i < n; i++) {
// finding sum of primary diagonal
**Type of change**
- [ ] Bug fix (fixes an issue)
- [ ] New feature (change adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Others (cosmetics, styling, improvements)
- [ ] This change requires a documentation update
@joelethan
joelethan / docker-help.md
Created May 28, 2020 13:16 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

import datetime
from flask import session, request, jsonify
from app.function import *
from app import users, userIds, parcels, parcelIds, old_usernames
from werkzeug.security import generate_password_hash, check_password_hash
class User:
#class to create users
def __init__(self, username, email, password):
from flask import Flask, request, session, jsonify,make_response
from app.models import *
from app.api.user_authentication import token_required
from app.function import json_response
from app import users, userIds, parcelIds, parcels, old_usernames
from flask_jwt_extended import create_access_token, get_jwt_identity, jwt_required
@app.route('/')
def index():
import psycopg2
class DatabaseConnection:
def __init__(self):
connection_credentials = """
dbname='postgres' user='postgres' password='166091postgres'
host='localhost' port='5432'
"""
try:
self.connection = psycopg2.connect(connection_credentials)
class SignUp:
def __init__(self):
self.user_bio=dict()
def add(self, username, password):
self.user_bio[username]=password
def get_password(self, username):
return self.user_bio[username]
tearDownimport unittest # python3
from signup import SignUp
class signUpTest(unittest.TestCase):
def setUp(self):
self.signup=SignUp()
def tearDown(self): #done with databases!!, break it
/* body{
background-color: black;
} */
/* Add a black background color to the top navigation */
.horizontal_nav {
background-color:black;
overflow: hidden;
padding: 10px;
border-color: #f442e5;
}