Skip to content

Instantly share code, notes, and snippets.

🚽
totally useless

Colin Rofls cmyr

Block or report user

Report or block cmyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am cmyr on github.
  • I am cmyr (https://keybase.io/cmyr) on keybase.
  • I have a public key whose fingerprint is EBDF 6E34 C4B6 E898 9B04 A3F8 9003 3316 D794 8447

To claim this, I am signing this object:

@cmyr
cmyr / gist:1c1c6fe52d6fa57034a0
Created Jan 9, 2015
Compiler warnings for FIXME:
View gist:1c1c6fe52d6fa57034a0
#!/bin/bash
WARNINGTAGS="FIXME:|\?\?\?:"
ERRORTAGS="\!\!\!:"
find "${SRCROOT}" \( -name "*.swift" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($WARNINGTAGS).*\$" | perl -p -e "s/($WARNINGTAGS)/ warning: \$1/"
if [ "${CONFIGURATION}" = "Release" ]
then
find "${SRCROOT}" \( -name "*.swift" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($ERRORTAGS).*\$" | perl -p -e "s/($ERRORTAGS)/ error: \$1/"
@cmyr
cmyr / suffix_simd.rs
Created Sep 11, 2018
Using simd in rust for suffix/prefix finding
View suffix_simd.rs
const SSID_OPTS: i32 = _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_UNIT_MASK
| _SIDD_LEAST_SIGNIFICANT | _SIDD_NEGATIVE_POLARITY;
/// # Examples
///
/// ```
/// let one = "aaaaaaaaaaaaaaaa";
/// let two = "aa3aaaaa9aaaEaaa";
/// //NOTE: reversed
/// let exp = "0001000100000100";
View async word wrap post mortem.md

2018-12-27

Update: line breaking and view revisions

So I had a frustrating week, last week. I'd been spending much of december working on a long-standing feature for xi, line breaking / word wrap. That is; the ability to wrap lines of text to the width of the window, as needed. This is table stakes for a text editor (or a text view, or a web browser, or anything that displays text in a variable width window) but it's something we had until now only half-done.

Background

This problem has some nuance. To back up: We have a string, and we have a width (of a window, say), and we need to determine how to break the string up so that it fits in the given window. To do this, we need to know two things at runtime: where in the string we are allowed to create a line break (the break opportunities), and the width required to draw various 'atoms' of the string, where an 'atom' is a sub-string that cannot contain a line break.

@cmyr
cmyr / rust-tips.md
Last active Feb 23, 2019
Rust quick tips collection
View rust-tips.md

Rust Tips & Suggestions

Struct forms:

There are three struct forms: unit structs, tuple structs, and named field structs:

struct UnitStruct;
struct TupleStruct(String, usize);
struct NamedStruct { string: String, is_cuss_word: bool }
You can’t perform that action at this time.