Skip to content

Instantly share code, notes, and snippets.

/*
Task Description
interval_map<K,V> is a data structure that efficiently associates intervals of keys of type K with values of type V. Your task is to implement the assign member function of this data structure, which is outlined below.
interval_map<K, V> is implemented on top of std::map. In case you are not entirely sure which functions std::map provides, what they do and which guarantees they provide, we provide an excerpt of the C++ standard here:
Each key-value-pair (k,v) in the std::map means that the value v is associated with the interval from k (including) to the next key (excluding) in the std::map.
Example: the std::map (0,'A'), (3,'B'), (5,'A') represents the mapping
@paulirish
paulirish / what-forces-layout.md
Last active May 11, 2024 20:51
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@wxllow
wxllow / useragent-switcher-preferences(1).json
Created May 11, 2024 20:51
useragent-switcher-preferences for AARCH64/ARM64 Linux (Asahi)
{
"blacklist": [],
"cache": true,
"custom": {
"netflix.com": "Mozilla/5.0 (X11; CrOS x86_64 15633.69.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.212 Safari/537.36"
},
"exactMatch": false,
"faqs": false,
"last-update": 1714282750222,
"log": false,
/**
* @category models
* @since 1.0.0
*/
export interface SqliteClient extends Client.Client {
readonly [TypeId]: typeof TypeId
readonly config: SqliteClientConfig
/** Not supported in d1 */
@arekmaz
arekmaz / drizzle-effect-schema.ts
Last active May 11, 2024 20:50
drizzle-effect-schema
import * as S from "@effect/schema/Schema";
import { Assume, Column, Equal, Table, getTableColumns, is } from "drizzle-orm";
import {
MySqlChar,
MySqlVarBinary,
MySqlVarChar,
} from "drizzle-orm/mysql-core";
import { PgArray, PgChar, PgUUID, PgVarchar } from "drizzle-orm/pg-core";
import { SQLiteText } from "drizzle-orm/sqlite-core";
import { Simplify } from "effect/Types";
@omayib
omayib / SimpleRepositoryPatternIn.swift
Created August 29, 2017 07:53
Introducing repository pattern with swift.
//: Playground - noun: a place where people can play
import UIKit
class Todo{
var tempId: UUID?
var id : Int
var title: String
var isCompleted: Bool
@danielgross
danielgross / mathpix2gpt.py
Last active May 11, 2024 20:48
mathpix2gpt.py
import requests
import time
import os
import sys
import openai
import tiktoken
from termcolor import colored
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip()
@YoSoyPhil
YoSoyPhil / README.md
Last active May 11, 2024 20:48
Install Canon EOS Utility 2 full version

How to install Canon EOS Utility 2 full version

EOS Utility 2.14.20a full version install

Go to Canon and select your camera model under software downloads. At the time this guide was written, the link was https://www.canon-europe.com/support/consumer_products/software/eos-utility.html

Select your camera and download "EOS Utility 2.14.20a Updater for Windows" (yes, we will do full install with this file).

Before we can run the installer we need to add a key to our registry.

@alexweberk
alexweberk / mlx_finetuning_gemma.ipynb
Last active May 11, 2024 20:40
MLX Fine-tuning Google Gemma
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tkrisztian95
tkrisztian95 / default.conf
Last active May 11, 2024 20:40
Nginx server JSON file as an API response
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www;
location /api/endpoint {
default_type application/json;
index apiResponse.json;
alias /var/www/;
}