Skip to content

Instantly share code, notes, and snippets.

@Israel025
Israel025 / catFacts.js
Created April 25, 2019 02:17
Writing functions and Tests
const axios = require('axios');
async function catFacts() {
try {
const response = await axios({
method: "get",
status: 200,
url: "https://cat-fact.herokuapp.com/facts/random?animal_type=cat&amount=3"
});
let extracts = response.data;
@Israel025
Israel025 / Stepwise Solution.txt
Last active April 16, 2019 23:58
Coding Hours Challenge - TimeOff App DB Modelling
Step 1: Identifying Entities:
Staff
Admin
Leave
Step 2: Identifying Attributes and Define Attributes Data types:
Staff: staff_id(int), first_name(string), last_name(string), email(string), organization(string), designation(string),
@Israel025
Israel025 / tomorrow.js
Last active April 17, 2019 18:38
weahter-cli application
const ora = require('ora');
const getWeather = require('../utils/weather');
const getLocation = require('../utils/location');
module.exports = async (args) => {
const spinner = ora().start();
try{
const location = args.location || args.l || await getLocation();
const weather = await getWeather(location);
@Israel025
Israel025 / hashing.js
Last active April 10, 2019 19:48
Implentation of a hash table
function HashTable() {
this.table = new Array();
this.dupList = [];
}
HashTable.prototype.hashMethod = function(input){
let strInput = input.toString();
const encoder = 27;
let hashCode = 0;
@Israel025
Israel025 / hashResponse.js
Last active April 8, 2019 19:38
A function to find the duplicates in an array using a hash table
// A hash table data structure helps to quickly find/compute data by using keys that are mapped to array
// positions by hash functions. values are stored and referenced by memory locations
// A hash table data structure is fast because its time complexity is O(1)
// (it only tranverse through an array once for each instance of an operation )
// I'm not sure but i think in JavaScript, addressing an array using string indexing makes
// the array a hash table data structure
@Israel025
Israel025 / querry response 1
Last active April 2, 2019 19:46
April 2, 2019 SQL Daily Challenge Response
select id, host_id, host_name, room_type from levelUp.listings where room_type = 'Private room' order By host_name ASC;