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 / cloudSettings
Created September 20, 2018 10:15
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-09-20T10:15:10.101Z","extensionVersion":"v3.1.2"}
@florestankorp
florestankorp / cloudSettings
Last active September 23, 2018 15:48
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-09-23T15:48:08.286Z","extensionVersion":"v3.1.2"}
/*
You Don't Know JS: Up & Going
Chapter 1: Into Programming - PRACTICE
https://github.com/getify/You-Dont-Know-JS/blob/master/up%20%26%20going/ch1.md
*/
let accountBalance = 303.91;
let totalPriceOfPurchase = 0;
const TAX_RATE = 0.08;
function myReplace(str, before, after) {
let index = str.indexOf(before);
if (str[index] === str[index].toUpperCase()) {
after = `${after[0].toUpperCase()}${after.slice(1)}`;
}
return str.replace(before, after)
}
@florestankorp
florestankorp / best-books.js
Created January 29, 2020 13:53
Mapping an array to object with default keys
const BOOKS = [
'1',
'The Stranger\nThe Outsider',
'Albert Camus',
'1942',
'French',
'2',
'In Search of Lost Time\nRemembrance of Things Past',
'Marcel Proust',
'1913–27',
-- 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
import sqlite3
import sys
def main():
if len(sys.argv) < 2:
print("I")
return
@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
"""
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
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