Skip to content

Instantly share code, notes, and snippets.

View mvandermeulen's full-sized avatar

Mark mvandermeulen

  • Fivenynes
  • Sydney, Australia
  • 20:54 (UTC +10:00)
View GitHub Profile
@sohamb1390
sohamb1390 / AnalyticsManager.swift
Last active February 24, 2025 20:45
Complete code gist of Analytics Service and Analytics Manager
import Foundation
import UIKit
@MainActor
final class AnalyticsManager {
static let manager: AnalyticsManager = AnalyticsManager()
private var services: [any AnalyticsService] = []
private init() {}
@Amzd
Amzd / Version.swift
Last active February 24, 2025 20:45
Semantic Version decoding in Swift. Does not validate the identifier.
/// https://gist.github.com/Amzd/93f2e7b4712242ec4e17476146f528a2
public struct Version: Codable {
public var major: UInt
public var minor: UInt
public var patch: UInt
public var identifier: String?
public var stringValue: String {
"\(major).\(minor).\(patch)" + (identifier.flatMap { "-\($0)" } ?? "")
}
@Erica-Iris
Erica-Iris / a.swift
Last active February 24, 2025 20:45
保存到app default
private let defaults = UserDefaults.standard
private let usernameKey = "username"
private let passwordKey = "password"
func saveLoginInfo(username: String, password: String) {
defaults.set(username, forKey: usernameKey)
defaults.set(password, forKey: passwordKey)
}
func getSavedUsername() -> String {
@developer-commit
developer-commit / capture.swift
Created January 25, 2025 07:32
example by window capture
// origanl code : https://stackoverflow.com/questions/78846311/screencapturekit-example-in-go-c
import Foundation
import ScreenCaptureKit
import CoreGraphics
import AppKit
func captureScreenshot(display: SCDisplay?, window: SCWindow, app: SCRunningApplication,completion: @escaping (NSImage?) -> Void) {
let filter: SCContentFilter
@mimansajaiswal
mimansajaiswal / A1-claude-artifact-llm-chat-to-md.md
Last active January 23, 2025 22:21
Creating a tiny web app that formats md exports from github copilot, chat gpt and claude to the markdown format I want

Note

mimansajaiswal: write me a small app that takes in text like this:

"mimansajaiswal: write notation-fold.ts similar to notion-highlight.ts where if a region is marked to be collapsed, it allows you to collapse it and expand it similar to code folding in ides. this is how it works with multiple lines in code highlight: Use [!code highlight] to highlight a line. ts console.log('Not highlighted') console.log('Highlighted') // [!code highlight] console.log('Not highlighted') Renders (with custom CSS rules): console.log('Not highlighted') console.log('Highlighted') console.log('Not highlighted') // [!code highlight] outputs: The outer

 tag is modified: 
 You can also highlight multiple lines with a single comment: ts // [!code highlight:3] console.log('Highlighted') console.log('Highlighted') console.log('Not highlighted') Renders: console.log('Highlighted') console.log('Highlighted') console.log('Not highlighted')"

and a

@ismasan
ismasan / Claude.mkd
Created January 10, 2025 14:53
Discord DDD-CQRS-ES aggregate boundaries discussion
  1. The discussion started with a question about when to use strong consistency (aggregates) versus eventual consistency, using a dinner reservation system as an example.

  2. Main insights about consistency and design:

  • Consistency boundaries should generally be kept small, ideally supporting single-concurrent-user operations
  • Eventual consistency can sometimes provide better business solutions, allowing for compensatory measures (like waitlists or discounts) rather than simple rejections
  • Consistency boundaries are discovered rather than defined, based on what decisions need to be made together
  1. Key principles about aggregates:
@jamesparsloe
jamesparsloe / autogit.py
Created January 10, 2025 10:30
Silly little script I use to sync my Obsidian notes to GitHub with a descriptive commit message
"""
Commit with a message generated by Claude and push.
"""
import argparse
import os
import subprocess
import anthropic
@kelechi2020
kelechi2020 / setup-mcp.md
Last active January 11, 2025 23:50

Guide to setting up Claude MCP on a MacBook

  1. Install Node.js
    Download the latest LTS version from Node.js.
    Verify installation:
    node --version
    npm --version
@andytriboletti
andytriboletti / social.py
Created January 8, 2025 19:12
Social media manager that integrates X, Instagram, LinkedIn, and uses local AI tools for content generation.
#open source code generated with Claude by Andy
#[email protected]
#The Postiz project is now AGPL.
#this code is public domain
import requests
import json
import time
from datetime import datetime
import schedule
@av
av / Claude 3.5 Sonnet.md
Last active January 12, 2025 02:06
Cardputer Replies

I can help you create a darkroom timer using the M5Stack Cardputer and a relay unit. This will allow you to control an enlarger or other darkroom equipment. Here's a basic implementation:

#include <M5Cardputer.h>

// Pin definitions
const int RELAY_PIN = 38;  // Adjust this according to your relay connection
const int DEFAULT_TIME = 10;  // Default time in seconds

// Global variables