Skip to content

Instantly share code, notes, and snippets.

View CostaFot's full-sized avatar

Costa Fotiadis CostaFot

View GitHub Profile
@Composable
fun ClockWidget(viewModel: ClockViewModel = koinViewModel()) {
val time by viewModel.time.collectAsState()
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Box(
modifier = Modifier
@Composable
fun App() {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Box(
modifier = Modifier
.clip(RoundedCornerShape(6.dp))
.background(Color(0x99000000))
Window(
// ....
undecorated = true, // kills the OS title bar
transparent = true, // makes the window background see-through
resizable = false,
alwaysOnTop = true,
// ....
) {
WindowDraggableArea { // since there's no title bar to drag, this wraps the content and handles it
App()
// Talk to Windows UI layer
[DllImport("user32.dll")]
// Read the window style
GetWindowLong(windowHandle, EXTENDED_STYLE)
// Add the "hide from taskbar" flag and apply it
SetWindowLong(windowHandle, EXTENDED_STYLE, currentStyle | 0x80)
const params = new URLSearchParams(window.location.search);
if (params.get("q")) {
const trySend = setInterval(() => {
const button = document.querySelector('button[aria-label="Send message"]');
if (button && !button.disabled) {
button.click();
clearInterval(trySend);
}
}, 200);
setTimeout(() => clearInterval(trySend), 5000);
chrome.contextMenus.onClicked.addListener((info) => {
if (info.menuItemId !== "askClaude") return;
const text = `I selected "${info.selectionText}" on my browser\n\nI would normally Google this. Tell me what I need to know.`;
chrome.tabs.create({ url: `https://claude.ai/new?q=${encodeURIComponent(text)}` });
});
{
"manifest_version": 3,
"name": "Ask Claude",
"version": "1.0",
"description": "Right-click selected text to ask Claude",
"permissions": ["contextMenus"],
"background": {
"service_worker": "background.js"
},
"content_scripts": [
@app.route("/claps", methods=["GET"])
def get_claps():
data, _ = get_claps_file()
key = normalise_url(request.args.get("url"))
return jsonify({"claps": data.get(key, 0)})
@app.route("/claps", methods=["POST"])
def add_clap():
data, sha = get_claps_file()
key = normalise_url(request.args.get("url"))
@CostaFot
CostaFot / RetainDecorator.kt
Created March 4, 2026 12:09
RetainDecorator.kt
class RetainDecorator<T : Any>(
retainedValuesStoreRegistry: RetainedValuesStoreRegistry,
) : NavEntryDecorator<T>(
decorate = { entry ->
logDebug { "Retaining ${entry.contentKey}" }
retainedValuesStoreRegistry.LocalRetainedValuesStoreProvider(entry.contentKey) {
entry.Content()
}
},
@Composable
fun GameScreen(
gameViewModel: GameViewModel = viewModel()
) {
// ...
}