Skip to content

Instantly share code, notes, and snippets.

View bhamiltoncx's full-sized avatar

Ben Hamilton (Ben Gertzfield) bhamiltoncx

View GitHub Profile
@bhamiltoncx
bhamiltoncx / gist:ee72545f17794af133ce6347f1c1f3d9
Created August 12, 2016 16:12
Sampling profile of 4 clients simultaneously querying watchman with reader-writer lock
% sample watchman
Sampling process 1877 for 10 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Sample analysis of process 1877 written to file /tmp/watchman_2016-08-12_090108_qS3o.sample.txt
Analysis of sampling watchman (pid 1877) every 1 millisecond
Process: watchman [1877]
Path: /usr/local/bin/watchman
Load Address: 0x103d27000
Identifier: watchman
@bhamiltoncx
bhamiltoncx / classify21.g4
Created February 17, 2017 18:47
Unicode code point classifier using new ANTLR4 full Unicode syntax
/** classify21.g4
Automatically generated Unicode 9.0.0 codepoint classification grammar.
Generated by "makeGrammars.py".
Author: Jonathan D. Lettvin ([email protected])
Date: 20161023
Legal: Copyright(c) Jonathan D. Lettvin, All Rights Reserved
License:GPL 3.0
public final class CodePointCounter {
private final String input;
public int inputIndex = 0;
public int codePointIndex = 0;
public int advanceToIndex(int newCodePointIndex) {
assert newCodePointIndex >= codePointIndex;
while (codePointIndex < newCodePointOffset) {
int codePoint = Character.codePointAt(input, inputIndex);
inputIndex += Character.charCount(codePoint);
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.headerViewController.headerView.trackingScrollView) {
[self.headerViewController.headerView trackingScrollViewDidScroll];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if (scrollView == self.headerViewController.headerView.trackingScrollView) {
@bhamiltoncx
bhamiltoncx / gist:83895a77882c96c081d200cf37505036
Created December 21, 2023 22:45
Repro for clang GMLT + LTO missing C++ namespace info
% clang++ --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode_15.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% cat test.cc
#include <stdio.h>
namespace foo {