Skip to content

Instantly share code, notes, and snippets.

View tcw165's full-sized avatar
💭
building AI

TC Wang tcw165

💭
building AI
View GitHub Profile
@tcw165
tcw165 / gist:5a85258df0e449431dd41e65e4bad014
Last active June 22, 2026 05:49
skills: morning-standup
---
name: morning-standup
description: Daily Graphite sync ritual — remember the current branch, move merged branches to pool before sync, sync trunk with gt sync on every linked worktree, finalize cleanup from primary, then return to the saved branch only if it is still open. Use at the start of a work session before new changes.
---
# Morning Standup
Start each work session by syncing trunk with Graphite while preserving your working branch.
Follow `/graphite` for all Git/Graphite operations — do **not** use raw `git checkout`, `git pull`, or `git push`.
@tcw165
tcw165 / settings.json
Last active June 5, 2022 20:21
My VSCode settings
{
"C_Cpp.autocompleteAddParentheses": true,
"C_Cpp.clang_format_sortIncludes": true,
"C_Cpp.codeAnalysis.updateDelay": 300,
"C_Cpp.default.mergeConfigurations": true,
"C_Cpp.experimentalFeatures": "Enabled",
"C_Cpp.intelliSenseEngineFallback": "Enabled",
"C_Cpp.intelliSenseUpdateDelay": 500,
"C_Cpp.workspaceSymbols": "All",
"cmake.configureOnOpen": true,
@tcw165
tcw165 / keybindings.json
Last active May 31, 2022 16:29
My VSCode keybindings
// Place your key bindings in this file to override the defaults
[
{
"command": "workbench.action.closeOtherEditors",
"key": "shift+cmd+w"
},
{
"command": "-workbench.action.closeOtherEditors",
"key": "alt+cmd+t"
},
import io.reactivex.Observable
import io.reactivex.ObservableSource
import io.reactivex.ObservableTransformer
import java.util.Optional
import java.util.concurrent.atomic.AtomicReference
/**
* A transformer that remembers the last value. For observer, you'll get a pair of
* last value and current value.
*
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.Filter
import androidx.annotation.LayoutRes
import com.fitbit.coin.kit.internal.service.FuzzySearchArrayAdapter.FuzzySearchFilter
import java.util.concurrent.CopyOnWriteArrayList
import android.text.Editable
import android.text.Spanned
import android.text.TextWatcher
import android.text.style.ReplacementSpan
import android.widget.EditText
import android.widget.TextView
import io.reactivex.Completable
import io.reactivex.disposables.Disposable
import java.text.NumberFormat
import java.util.Currency
import android.graphics.Canvas
import android.graphics.Paint
import android.text.style.ReplacementSpan
import kotlin.math.ceil
/**
* Spans for annotating the TextView or EditText with a character.
*/
internal class CharAnnotationSpan(
private val symbol: Char,
class Solution {
public List<String> removeInvalidParentheses(
String s
) {
// Find how many left and right parentheses to remove.
final int[] parenToRemove = new int[2];
computeParanToRemove(s, parenToRemove);
final int l = parenToRemove[0];
final int r = parenToRemove[1];
class Solution {
private final static char NULL_CHAR = '_';
private final static int PADDING = 1;
public boolean isMatch(String s, String p) {
final List<String> pattern = extractPattern(p);
// System.out.println(String.format("Search string: %s", s));
// System.out.println(String.format("Regex pattern: %s", pattern));
@tcw165
tcw165 / simplified-regex-DFA(automata)-solver.java
Last active August 19, 2019 16:57
An automata matcher inspired by https://leetcode.com/problems/regular-expression-matching/. However, the problem is not a typical Regex problem.
class Solution {
// Example:
// Input:
// search string: "missia"
// pattern string: "mis*is*p*."
// Output:
// Regex DFA graph: ["m", "i", "s*", "i", "s*", "p*", "."]
// [0]=m vs m
// [1]=i vs i