Skip to content

Instantly share code, notes, and snippets.

View randomor's full-sized avatar

Shaomeng Zhang randomor

View GitHub Profile
@randomor
randomor / MenuBarIconRotationApp.swift
Created January 23, 2025 04:20
Animating Menubar Icon
import SwiftUI
import AppKit
@main
struct AnimatedSVGMenuBarApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ControlPanelView()
//Original article: https://multi.app/blog/pushing-the-limits-nsstatusitem
import SwiftUI
import Combine
@main
struct MenuBarApp: App {
// Tie our custom AppDelegate into SwiftUI's lifecycle
@NSApplicationDelegateAdaptor private var appDelegate: AppDelegate
@randomor
randomor / App.swift
Last active December 20, 2024 17:43
3D card scroll view
import SwiftUI
import AppKit
struct ScatteredCardsView: View {
@AppStorage("notesPerDay") private var notesPerDay: Double = 5
@AppStorage("visibleDepthDays") private var visibleDepthDays: Double = 7
@AppStorage("secondsPerPixel") private var secondsPerPixel: Double = 100
@State private var notes: [Note] = []
@State private var scrollOffset: CGFloat = 0
@randomor
randomor / test.md
Last active November 13, 2020 20:08

uml: sequence diagram

Here I will embed PlantUML markup to generate a sequence diagram.

I can include as many plantuml segments as I want in my Markdown, and the diagrams can be of any type supported by PlantUML.

@startuml
    skinparam backgroundColor #EEEBDC
    skinparam handwritten true
 actor Customer
@randomor
randomor / App.swift
Last active February 19, 2021 20:59
SwiftUI 2020 + CloudKit + Core Data ZenJournal prototype: https://thezenjournal.com
import SwiftUI
import CoreData
let appTransactionAuthorName = "app"
@main
struct ZenJournalApp: App {
var body: some Scene {
WindowGroup {
## Intro
少蒙
https://twitter.com/@randomor
https://thezenjournal.com
https://flipgrid.com
[[#React]]
@randomor
randomor / Fastfile
Created March 10, 2019 01:33
Zenjournal Fastfile for React Native
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
### Keybase proof
I hereby claim:
* I am randomor on github.
* I am randomor (https://keybase.io/randomor) on keybase.
* I have a public key ASDClQi_6MuyBI7WhKSvZaUNBGGTa3-c_3QbFRc3CKSiZQo
To claim this, I am signing this object:
@randomor
randomor / neo4j-cli
Created November 3, 2015 19:56 — forked from jexp/neo4j-cli
Script to start Neo4j with custom database, host and port
#!/bin/bash
echo "Usage bin/neo4j-cli [path/to/db] [host-or-ip] [port]"
DIR=${0%%neo4j-cli}
DB=${1-data/graph.db}
IP=${2-127.0.0.1}
PORT=${3-7474}
CONFIG=${DIR}../conf/neo4j-server.properties
@randomor
randomor / laravel-elixir-gulp-include
Last active August 29, 2015 14:07
For using gulp-include with laravel-elixir
//Currently I'm creating the processed coffee file in a temporary directory inside `resources/assets/coffee` for it to be picked up by `mix.coffee`
//And this task also doesn't work for js, scss or css, even though elixir does provide some native support for `@import`.
//Alternative ways of integrate `gulp-include` with `laravel-elixir` is thus deeply appreciated.
elixir.extend('includeFiles', function(src, output) {
var baseDir = this.preprocessors.baseDir + 'coffee/';
src = this.buildGulpSrc(src, baseDir, '**/*.coffee');