Skip to content

Instantly share code, notes, and snippets.

View hansamlin's full-sized avatar
🎯
Focusing

Sam Lin hansamlin

🎯
Focusing
View GitHub Profile
class LinkedListNode {
constructor(value) {
this.next = null;
this.value = value;
}
}
class LinkedList {
constructor() {
this.head = null;
@hansamlin
hansamlin / isJavaScriptProtocol.js
Created December 29, 2023 08:57
check is javascript protocol
export const isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
@hansamlin
hansamlin / dom_performance_reflow_repaint.md
Created July 23, 2024 08:38 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
/* http://meyerweb.com/eric/tools/css/reset/
v5.0.2 | 20191019
License: none (public domain)
*/
html,
body,
div,
span,
applet,
{
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"editor.tabSize": 2,
"editor.rulers": [80],
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
@hansamlin
hansamlin / statusline.sh
Last active March 26, 2026 15:17
statusline.sh
#!/bin/bash
# Read JSON input from stdin
input=$(cat)
echo "$input" >> /tmp/statusline_debug.log
# Extract values using jq
MODEL=$(echo "$input" | jq -r '.model.display_name')
# Get git branch if in a git repo
GIT_BRANCH=""
{
"$schema": "https://opencode.ai/config.json",
"agent": {
"plan": {
"permission": {
"read": "allow",
"edit": "deny",
"glob": "allow",
"grep": "allow",
"list": "allow",