Skip to content

Instantly share code, notes, and snippets.

View hokevins's full-sized avatar

Kevin Ho hokevins

View GitHub Profile
@hokevins
hokevins / closurePartialCurrying.js
Created March 20, 2023 14:39
Notes on functional programming fundamentals: Closure vs Partial Application vs Currying
// Functional Programming: Closure, Partial Application, and Currying
const add = (...args) => args.reduce((a, e) => a + e, 0);
console.log(add(5, 3)) // 8
/*
Partial application allows us to fix a function’s arguments. This lets us derive new functions, with specific behavior, from other, more general functions.
Partial application: A function returning another function that might return another function, but each returned function can take several parameters.
@hokevins
hokevins / cassidooQuestions.js
Last active March 27, 2023 14:15
cassidoo's Interview question of the week from Cassidy Williams' newsletter
// 2023-03-27
// Given a string in dice notation, return a random integer you can get by rolling those dice.
const rollDice = input => {
const getRandomInt = max => {
return Math.floor(Math.random() * max) + 1;
};
let sum = 0;
let rolls = input.split('+');
@hokevins
hokevins / interview-questions.md
Created July 18, 2018 09:24 — forked from jvns/interview-questions.md
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@hokevins
hokevins / REACTO - Palindrome Chain Length Problem.md
Created March 2, 2018 01:19
REACTO - Palindrome Chain Length Problem

REACTO - Palindrome Chain Length Problem

(From Codewars: 5kyu problem.)

Number is a palindrome if it is equal to the number with digits in reversed order. For example, 5, 44, 171, 4884 are palindromes and 43, 194, 4773 are not palindromes.

Write a method palindrome_chain_length which takes a positive number and returns the number of special steps needed to obtain a palindrome. The special step is: "reverse the digits, and add to the original number". If the resulting number is not a palindrome, repeat the procedure with the sum until the resulting number is a palindrome.

If the input number is already a palindrome, the number of steps is 0.