Skip to content

Instantly share code, notes, and snippets.

View mwafrika's full-sized avatar
🖐️
Available for hire

MWAFRIKA MUFUNGIZI mwafrika

🖐️
Available for hire
View GitHub Profile
@mwafrika
mwafrika / mysql_cheat_sheet.md
Last active October 20, 2022 16:43 — forked from bradtraversy/mysql_cheat_sheet.md
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

function countApplesAndOranges(s, t, a, b, apples, oranges) {
// Write your code here
let orangeCounter = 0;
let appleCounter = 0;
for(let i = 0; i<apples.length; i++){
if(a+apples[i] >= s && a+apples[i] <= t){
appleCounter++;
}
}
@mwafrika
mwafrika / Calendar 2
Created July 2, 2022 20:49
Calendar2
import React from 'react';
import moment from 'moment';
import { useEffect, useState } from 'react';
const Calender = () => {
const [currentYear, setCurrentYear] = useState(moment().year());
const [currentMonth, setCurrentMonth] = useState(moment().month());
const [currentDate, setCurrentDate] = useState(moment().date());
const [currentDay, setCurrentDay] = useState(moment().day());
const [startFromLastWeek, setStartFromLastWeek] = useState(false);
import moment from 'moment';
import { useEffect, useState } from 'react';
const Calender = (props) => {
const [currentYear, setCurrentYear] = useState(moment().year());
const [currentMonth, setCurrentMonth] = useState(moment().month());
const [currentDate, setCurrentDate] = useState(moment().date());
const [currentDay, setCurrentDay] = useState(moment().day());
const [startFromLastWeek, setStartFromLastWeek] = useState(false);
const [currentWeek, setCurrentWeek] = useState({});
/**
* @param {number[]} nums
* @return {number}
*/
var singleNumber = function(nums) {
let sortedArray = nums.sort((a,b)=>a-b)
for(let i=0;i<sortedArray.length; i+=2){

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

# @param {Character[]} s
# @return {Void} Do not return anything, modify s in-place instead.
def reverse_string(s)
for i in (0..((s.length - 1) / 2)) do
tmp = s[i]
s[i] = s[s.length - 1 - i]
s[s.length - 1 - i] = tmp
end
@mwafrika
mwafrika / abozgxq.markdown
Last active August 18, 2019 07:47
aboZGxq