Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hemanthpai
hemanthpai / color-utils.ts
Created January 24, 2019 00:00
Color Utils Solution
//TODO: Implement hexToRgb
export const hexToRgb = (rgb:string) => {
const rgbComponents = extractComponents(rgb);
return {r: parseInt(rgbComponents.r, 16),
g: parseInt(rgbComponents.g, 16),
b: parseInt(rgbComponents.b, 16)
};
}
@hemanthpai
hemanthpai / dealer.ts
Last active January 23, 2019 21:50
Card Dealer Solution
import { number, element } from "prop-types";
/**
* Shuffle an array in place
* @param a Array to shuffle
*/
function shuffleArray(a: any[]) {
// Iterate over the array
for (let i = a.length; i; i--) {
// Get next index