Skip to content

Instantly share code, notes, and snippets.

View florestankorp's full-sized avatar
🇳🇱
Frontend Dev

Florestan Korp florestankorp

🇳🇱
Frontend Dev
View GitHub Profile
@florestankorp
florestankorp / most-popular-sport-type-in-movies.js
Created February 12, 2022 20:42
Data analysis of the most popular type of sport in sports-movies
"""
Tic Tac Toe Player
"""
import math
import random
import copy
X = "X"
O = "O"
-- Write a SQL query to list the titles of the five highest rated movies
-- (in order) that Chadwick Boseman starred in, starting with the highest rated.
-- Your query should output a table with a single column for the title of each movie.
-- You may assume that there is only one person in the database with the name
-- Chadwick Boseman.
SELECT title, rating
FROM movies
JOIN ratings on movies.id = ratings.movie_id
JOIN stars on movies.id = stars.movie_id
@florestankorp
florestankorp / filter.c
Created August 23, 2022 07:29
Part of Harvard's CS50X Course: pset4 Filter - Apply operations to a BMP file
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "helpers.h"
int main(int argc, char *argv[])
{
// Define allowable filters
char *filters = "bgrs";
@florestankorp
florestankorp / README.md
Last active May 2, 2023 11:23
Scenario based API mocking with `ng-apimock`

Scenario based API mocking with ng-apimock

Overview

ng-apimock is a tool that provides scenario based API mocking. It can be used to test and develop applications without the need of a backend. Alternatively you can also chose to let certain calls through to the actual backend and apply mocking selectively.

import { HarnessLoader, parallel } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { MatStepperModule } from '@angular/material/stepper';
import {
MatStepHarness,
MatStepperHarness,
MatStepperNextHarness,
MatStepperPreviousHarness,
} from '@angular/material/stepper/testing';
// define a type for the path of the nested key
type Path = (string | number)[];
// define a generic function that can access a nested property of an object
function getNestedValue<T> (obj: T, path: Path): any {
// if path is empty, return the whole object
if (!path.length) return obj;
// loop through the path and access each nested property
let value = obj;
for (let key of path) {