Skip to content

Instantly share code, notes, and snippets.

@kconner
kconner / macOS Internals.md
Last active November 13, 2024 07:51
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@brentsimmons
brentsimmons / gist:5810992
Last active January 3, 2021 02:22
Detect a tap on a URL inside a UITextView. Note: the rs_links method isn't included -- you'll need something that takes text and returns an array of detected links. This gist just demonstrates walking through the UITextView characters.
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;
public final static RuntimeException ᚇ = new RuntimeException("┻━┻");
public void ノಠ益ಠノ彡(RuntimeException t) { throw t; }
public void ノಠ益ಠノ彡(Throwable t) { throw new RuntimeException(t); }
public int hashCode() {
ノಠ益ಠノ彡(ᚇ);
return 0;
}
@mikedory
mikedory / gist:3299167
Created August 8, 2012 21:57
McKayla It
javascript:(function(){ var body=document.getElementsByTagName("body")[0];var mckayla="http://f.cl.ly/items/1A1w013w0Q3p380a2N3x/mckayla.png";var mckaylaDiv=document.createElement("img");mckaylaDiv.src=mckayla;mckaylaDiv.style.position="absolute";mckaylaDiv.style.width="300px";mckaylaDiv.style.right=0;mckaylaDiv.style.bottom=0;body.appendChild(mckaylaDiv) })();
@unclebob
unclebob / apology.
Created April 27, 2012 12:19
Apology to Women Programmers.
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up
@gordonbrander
gordonbrander / construct.js
Created March 5, 2012 18:44
construct -- an alternate way to invoke constructor functions
// Bind another function as the `this` context for `construct` to create
// a method that will construct the given function and return the object
// directly, enabling immediate chaining.
//
// A bound version of `construct` can be thought of as a Functor, converting data in (the function)
// to a new kind of data out (the constructed object).
//
// Before:
//
// var f = new F();
@brendanberg
brendanberg / lisp.coffee
Created August 24, 2011 07:11
Lisp list functions in CoffeeScript
cons = (h, t) -> (m) -> m(h, t)
car = (x) -> x((h, t) -> h)
cdr = (x) -> if x then x((h, t) -> t) else null
map = (ls, f) ->
cons (f car ls), if cdr ls then map cdr(ls), f else null
foldl = (ls, f, n) ->
f (car ls), if cdr ls then foldl (cdr ls), f, n else n
@fbuchinger
fbuchinger / gist:674212
Created November 12, 2010 15:26
OxJs - jQuery for your Bytes

OxJs - jQuery for your Bytes

OxJs (speak: HexaJs) is a utility library for javascript, that facilitates parsing and creation of binary data in Javascript. While this sounds weird in the first moment, there are a few areas where OxJs can come in handy:

  • If you need to transfer huge amounts of numercial data via AJAX, binary encoding can be much more space-efficient than transfering it in JSON. The number 41239 for example needs 5 Bytes in JSON, but only 2 Bytes in binary encoding (unsigned short). A more practical example is the The Google Maps Polyline Utility, which saves over 80% of the json payload by binary encoding. However, de- and encoding binary information can be a quite tricky and this is were OxJs helps.

  • For client-side file parsing: Recent enhancements in Javascript allow us byte access for to-be-uploaded files. This can be used to perform enhanced sanity che