Skip to content

Instantly share code, notes, and snippets.

View chidioguejiofor's full-sized avatar
🏠
Working from home

Chidiebere Oguejiofor chidioguejiofor

🏠
Working from home
View GitHub Profile
@chidioguejiofor
chidioguejiofor / CHANGELOG.md
Last active November 25, 2021 13:48
Changelog example

release-7 (2021-10-12)

Automation

New Features

@chidioguejiofor
chidioguejiofor / eager-loading.py
Last active February 4, 2020 13:12
Install flask, Flask-SQLAlchemy and "psycopg2-binary".
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import logging
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] ='postgresql://<username>:password@localhost/<db-name>'
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
app.config['FLASK_ENV'] = 'development'
db = SQLAlchemy(app)
@chidioguejiofor
chidioguejiofor / results.sql
Last active November 29, 2019 19:32
Used in a blog post
CREATE TABLE results(
id SERIAL PRIMARY KEY,
student_id INT NOT NULL,
course VARCHAR NOT NULL,
score INT NOT NULL,
course_end_date DATE,
UNIQUE(student_id, course)
)
@chidioguejiofor
chidioguejiofor / result.sql
Created November 20, 2019 06:38
Result Table data used in a blogpost I wrote
CREATE TABLE results(
id SERIAL PRIMARY KEY,
student_id INT NOT NULL,
subject VARCHAR NOT NULL,
score INT NOT NULL,
UNIQUE(student_id, subject)
)
;
@chidioguejiofor
chidioguejiofor / request.js
Created August 13, 2019 17:27
OOP for models
class Request{
tableName = "request";
insertColumns =["body","image","user_id"];
retrievalString = "body, image, user_id AS userId";
create(*params){
const valueArr = [];
self.insertColumns.forEach((element, index) => {
valueArr.push(`$${index+1}`);
});
const valueString = valueArr.join(',')
@chidioguejiofor
chidioguejiofor / Question 1.js
Last active April 9, 2019 19:31
This is a test gist
function newName(){
alert('Name');
}
from datetime import datetime, timedelta
from dateutil.rrule import rrule, WEEKLY, DAILY
def get_number_of_weeks(smaller_date, bigger_date):
return rrule(DAILY, dtstart = smaller_date ,until=bigger_date).count()
if __name__ == '__main__':
@chidioguejiofor
chidioguejiofor / create article
Last active July 25, 2018 13:26
This test is checks that a
import { expect } from 'chai';
import supertest from 'supertest';
import app from '../app';
const request = supertest(app);
describe('POST /api/v1/articles', ()=> {
describe('if the request is valid', () => {
describe('request body', ()=> {