This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Annotated, Any, overload | |
import pydantic | |
@overload | |
def model_replace[T: pydantic.BaseModel](val: T, /, **kwargs) -> T: ... | |
@overload | |
def model_replace[T: pydantic.BaseModel](val: T, _partial: T, /) -> T: ... | |
def model_replace[T: pydantic.BaseModel](val: T, _partial: T | None = None, /, **kwargs) -> T: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2024 Opulo, Inc | |
* Published under the Mozilla Public License | |
* Full text available at: https://www.mozilla.org/en-US/MPL/ | |
*/ | |
import { isFunction } from "@glimmer/common/types"; | |
import { | |
AsyncDirective, | |
LitElement, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper for watching reactive properties (@property) or internal state (@state) | |
* and calling a callback. | |
* | |
* Adapted from Shoelace: | |
* - https://github.com/shoelace-style/shoelace/blob/64996b2d3512a13d2ec68146fb92164d03e07e6a/src/internal/watch.ts | |
*/ | |
import type { PropertyValues, ReactiveElement } from "lit"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
ANIMALS = list( | |
"🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🐔🐧🐦🐤🪿🦆🦉🦇🦇🐺🐗🐴🦄🫎🐝🪱🐛🦋🐌🐞🐜🪰🪲🪳🦟🦗🕷️🕸️🦂🐢🐍🦎🦖🦕🐙🦑🪼🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🦭🐊🐅🐆🦓🦍🦧🦣🐘🦛🦏🐪🐫🦒🦘🦬🐃🐂🐄🫏🐎🐖🐏🐑🦙🐐🦌🐕🐩🐈🐓🦃🦤🦚🦜🦢🦩🕊️🐇🦝🦨🦡🦫🦦🦥🐁🐀🐿️🦔🐉🐲" | |
) | |
ANIMALS_LEFT = [] | |
THREAD_EMOJI = {} | |
def thread_emoji(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
for (int i = 0; i < 5; i++) { | |
print('hello ${i + 1}'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <cmath> | |
/* | |
Examples for converting between note numbers, frequencies, and Volts/octave. | |
If you're unfamiliar with MIDI note numbers, they are integers that | |
correspond to semitones (half steps). For example, MIDI note 12 is | |
C1 (16.35 Hz) and MIDI note 24 (twelve half steps higher) is C2 (32.70 Hz). | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FutureBuilder( | |
future: future, | |
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { | |
double width; | |
switch(snapshot.connectionState) { | |
case ConnectionState.none: | |
case ConnectionState.waiting: | |
case ConnectionState.active: | |
width = 0; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (c) 2019 Alethea Flowers | |
# Licensed under the MIT license. | |
"""A helper library to setting a DAC to direct voltage values. | |
That is, instead of setting a 16-bit integer value you can set the DAC to a | |
floating-point voltage value. | |
This requires information about the real-world DAC output and any output | |
scaling - this is called **calibration** data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (c) 2019 Alethea Flowers | |
# Licensed under the MIT license. | |
"""A driver for the Analog Devices AD5689(R) 16-bit Digital to Analog Converter. | |
AD5689 wiring expectations (TSSOP-16 package): | |
* 1: AD5689 = Vref, AD5689R = NC (uses internal reference) | |
* 2: NC | |
* 3: Analog output A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
NewerOlder