Skip to content

Instantly share code, notes, and snippets.

from PIL import Image
import os
# Define the directory where tiles are stored and the output file
tiles_dir = 'tiles_zoom_16' # Replace with your directory
output_file = 'combined_image_16.png'
# Define the tile size (standard is 256x256 pixels)
tile_size = 256
@kezzico
kezzico / swift-cache.swift
Last active December 11, 2023 19:45
Code Sample: Cache in Swift
/*
You are building a small part of this iOS application that needs to implement a simple key-value type of cache. In Swift, you will need to implement a cache class with the functions add, get, and size.
The add function takes two parameters, a key and value and adds the pair to the local cache. When an item is added to the cache, this function should return the string "added" and if the item already existed in the cache, this function should return the string "overwritten"
The get function attempts to retrieve an item from the cache based on the key parameter passed in. If the item exists in the cache, return the value, otherwise return the string "miss"
The size function simply returns the number of items in the cache.
Your goal is to implement the cache class so the function calls in the main method work properly. The output of your program should be a final string with the function outputs separated by a space.
@kezzico
kezzico / react-weather-dashboard.js
Created December 11, 2023 19:42
React Weather Dashboard
/*
Front-end Challenge
We provided some simple React template code. Your goal is to build a weather dashboard application that lets users search for current weather conditions in different cities.
When the app loads, it should display a search bar where users can type in a city's name. Once the city name is entered (case-sensitive) and the user hits the "Search" button, the app should fetch and display the current temperature, humidity, and wind speed for the chosen city. For simplicity, you don't have to make actual API calls; instead, use the predefined data to mimic the weather data for a few cities.
Additionally, all previously searched cities should be listed below the search bar as buttons. When a user clicks on a previously searched city, its weather data should be displayed again.
Ensure the application handles scenarios where the city is not in your mock data by displaying a message: "City not found." You are free to add classes and styles, but make sure you leave the component ID's and classes pr
@kezzico
kezzico / kotlin.md
Last active December 5, 2023 18:08

KOTLIN CRASH COURSE

Variables

There are 2 types of variables in Kotlin. Variables declared with val are immutable. Whereas variables declared with var are mutable.

Kotlin can infer a Variable's type at compile time. Variables that cannot be inferred can be explicitly typed.

val x:Int = 2
@kezzico
kezzico / cwd.md
Last active November 9, 2023 19:41

Current Working Directory

In a shell environment, the current working directory is the directory 'you' are currently in. Unless specified by an absolute path all file references are made relevant to the current working directory. In short, the current working directory is the first place programs will look.

Directory map with you are here pin

Examples Using Current Working Directory

Here are some examples.

@kezzico
kezzico / python-packages.md
Last active October 29, 2023 21:10
Python: All About Packages

Python: All About Packages

Packages are a neat way for coders to quickly extend their project's capabilities. At its core, Python is a programming langauge like any other. It does not have an HTTP server, AI training modules, or even the data analysis tools that Python is known for. These all come from packages.

Python packages are hosted on PyPi.org. PyPI is an open source project developed under the umbrella of the Python Packaging Authority (PyPA) and supported by the Python Packaging Working Group.

Popular Packages

Here are just a few packages that you can download into your Python Environment.

@kezzico
kezzico / python-howto-start-app.md
Created October 20, 2023 18:32
Python: How to start the application

HOW TO START THE PYTHON APPLICATION

First Python must be installed in your path.

To confirm, enter which python or which python3 into the shell.

To start the application

The application is called script.py. Enter either python or python3 followed by the filename of the main script.

@kezzico
kezzico / flasp-app-template.md
Last active October 20, 2023 18:35
PYTHON: Flask Application Template

Node.js: Express MVC

Link to sample code

Designing a Node.js/Express API following the Model-View-Controller (MVC) architectural pattern utilizing middleware is a common and effective approach.

Express.js is a popular Node.js web application framework known for its flexibility and simplicity.

A core concept that underlies much of its power and versatility is middleware.

module.exports = {
meta: {
type: 'layout', // Specify the rule type ('problem', 'suggestion', or 'layout')
fixable: 'whitespace', // Allow ESLint to fix the issues automatically
},
create: function (context) {
return {
FunctionDeclaration(node) {
const params = node.params;
for (let i = 1; i < params.length; i++) {