Skip to content

Instantly share code, notes, and snippets.

View tamunoibi's full-sized avatar

Ib Aprekuma tamunoibi

View GitHub Profile
@tamunoibi
tamunoibi / .git-commit-explained
Created May 24, 2019 11:29
Snippet for creating feature pull requests
# Hey there o/!
#
# We just wanted to let you know that we care a great deal about
# making our git history clean, maintainable and easy to access for
# all our contributors. Commit messages are very important to us,
# which is why we have a strict commit message policy in place.
# Please use the following guidelines to format all your commit
# messages:
#
# <type>(<scope>): <subject>
@tamunoibi
tamunoibi / .git-commit-template
Created May 24, 2019 09:14 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
{
"name": "banka",
"version": "1.0.0",
"description": "An App to handle core banking applications",
"main": "server/app.js",
"scripts": {
"start": "babel-node server/app.js",
"bootcamp:build": "babel server/app.js -d build && build/server/app.js",
"ayo": "nodemon server/helpers/Authenticator.js --exec babel-node --presets babel-preset-env ",
"dev": "nodemon server/app.js --exec babel-node --presets babel-preset-env",
import { Pool } from 'pg';
import dotenv from 'dotenv';
dotenv.config();
// const config = {
// development: process.env.DEVELOPMENT_URL,
// test: process.env.TEST_URL,
// production: process.env.PRODUCTION_URL,
// };
@tamunoibi
tamunoibi / Git
Last active April 15, 2019 07:56
Git
GIT
`git stash apply` --- to get back git stash
``
@tamunoibi
tamunoibi / Codeclimate setupe
Created April 13, 2019 11:53
Configuration for code climate
plugins:
duplication:
enabled: true
checks:
argument-count:
config:
threshold: 4
complex-logic:
config:
threshold: 4
// Updating
const { accountId } = req.params;
const account = accounts.find(singleAccount => singleAccount.accountNumber === accountId);
// Handle cases where account with such an accountNumer is not found
if (!account) {
return res.status(400).json({
status: 'error',
//Deleting
const { accountId } = req.params;
const account = accounts.find(singleAccount => singleAccount.accountId === accountId);
// Handle cases where account with such an accountId is not found
if (!account) {
return res.status(400).json({
status: 'error',
message: 'No account with the given email',
@tamunoibi
tamunoibi / Object key=value
Created April 13, 2019 08:53
This helps to check if
// Checking if object.key is same as a variable
const user = {
email: "John@example.com",
password: "123pass",
}
Object.entries(user).forEach(([key, value]) => {
console.log(`${key} ${value}`);
if (user.email === 'John@example.com') {
return user;
Task
Finish the function numberToOrdinal, which should take a number and return it as a string with the correct ordinal indicator suffix (in English). For example, 1 turns into "1st".
For the purposes of this challenge, you may assume that the function will always be passed a non-negative integer. If the function is given 0 as an argument, it should return '0' (as a string).
To help you get started, here is an excerpt from Wikipedia's page on Ordinal Indicators:
st is used with numbers ending in 1 (e.g. 1st, pronounced first)
nd is used with numbers ending in 2 (e.g. 92nd, pronounced ninety-second)
rd is used with numbers ending in 3 (e.g. 33rd, pronounced thirty-third)