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
// 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) {
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';
@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.

@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";
"""
Tic Tac Toe Player
"""
import math
import random
import copy
X = "X"
O = "O"
@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
@florestankorp
florestankorp / .eslintrc.js
Created April 19, 2021 13:52
ES Lint Rules
module.exports = {
ignorePatterns: ['.eslintrc.js'],
env: {
browser: true,
es6: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
firstname,password,content,rating
bertrand1982,X5v4ADGuBN,Pellentesque viverra pede ac diam. Cras pellentesque volutpat dui.,4
thacher1983,Wiag8z,"Nunc nisl. Duis bibendum, felis sed interdum venenatis, turpis enim blandit mi, in porttitor pede justo eu massa.",3
jereme1982,BguqtD,Nullam porttitor lacus at turpis. Donec posuere metus vitae ipsum. Aliquam non mauris. Morbi non lectus. Aliquam sit amet diam in magna bibendum imperdiet.,1
delora1980,F1lQIPAR,"Proin at turpis a pede posuere nonummy. Integer non velit. Donec diam neque, vestibulum eget, vulputate ut, ultrices vel, augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec pharetra, magna vestibulum aliquet ultrices, erat tortor sollicitudin mi, sit amet lobortis sapien sapien non mi.",3
ursuline1975,MpmI7BGBCmMi,"Integer non velit. Donec diam neque, vestibulum eget, vulputate ut, ultrices vel, augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec pharetra, mag
"""
Seed database with users, reviews and ratings
MOCK_DATA.csv
https://gist.github.com/florestankorp/f81c87c09866280556807a0c0858297a
"""
import csv
import os
from random import randint
from sqlalchemy import create_engine
@florestankorp
florestankorp / image_delete_cli.py
Last active April 15, 2020 20:05
Final project for CS50x - Harvard's Introduction to Computer Science
# Resources
# https://www.pyimagesearch.com/2015/09/07/blur-detection-with-opencv/
# https://stackoverflow.com/questions/52505906/find-if-image-is-bright-or-dark
# https://towardsdatascience.com/automatic-image-quality-assessment-in-python-391a6be52c11
# https://towardsdatascience.com/deep-image-quality-assessment-with-tensorflow-2-0-69ed8c32f195
"""
This CLI takes in a path, brightness and sharpness thresholds and then
recursively searches images in the provided folder, evaluates the file
and either keeps the ones of acceptable quality or moves them to the trashbin