Skip to content

Instantly share code, notes, and snippets.

@swillits
swillits / allowsDefaultTighteningForTruncation.md
Last active December 2, 2016 01:11
NSAttributedString drawing squeezing broken -- allowsDefaultTighteningForTruncation
Natural attrStr.size is (width = 1578, height = 15)

NSRect stringRect = ...
[attrString drawWithRect:stringRect options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine];

Drawn with size {500, 60} works as expected (wraps, no squeezing):

// ================================================================
// Example 1:
@implementation MTLRenderPassDescriptor
+ (MTLRenderPassDescriptor *)renderPassDescriptor
{
enum RandomError: ErrorType {
case UglyRandomError
}
enum TheirError: ErrorType {
case SlimeyThereError
}
// Subclass -> Superclass -> NSObject
//
// NSObject's designated initializer is -init
// Superclass's designated initializer is -initWithSomething:
// Subclass's designated initializer is -initWithSomethingElse:
//
// Superclass cannot be initialized with -init
// Subclass cannot be initialized with -init
// Subclass cannot be initialized with -initWithSomething:
//
@swillits
swillits / uyvy422.c
Last active August 29, 2015 14:17 — forked from roxlu/uyvy422.c
static const char* YUYV_VS = ""
"#version 150\n"
"uniform mat4 u_pm;"
"uniform mat4 u_mm;"
"in vec4 a_pos;"
"in vec2 a_tex;"
"out vec2 v_tex;"
"void main() {"
" gl_Position = u_pm * u_mm * a_pos; "
//
// AGEnqueueCoalescedBlock.h
// EnqueuedBlocks
//
// Created by Seth Willits on 2/26/15.
// Copyright (c) 2015 Araelium Group. All rights reserved.
//
#import <Foundation/Foundation.h>
// In a class hierarchy, it's common for superclasses to require that their subclasses
// override certain methods. Unfortunately the compiler is of no help in enforcing
// this, as there is no annotation to produce a warning if a subclass does not.
//
// Call EnforceSubclassesImplement(class, protocol) to register that direct subclasses
// of the given class must implement the required methods of the given protocol.
// At runtime in debug (#define DEBUG 1) builds before main() is called, checking is
// done and will log each missing method implementation and abort() early.
//
// By placing this call in +load of a parent class, no other work ever need be done.
@swillits
swillits / NSDICT.m
Last active May 2, 2023 13:48
Obj-C NSDictionary Literal-like syntax allowing nil values
/*
---------------------------------------------------------------------------------------
Obj-C Literal Dictionary Syntax - Multiple reasons for allowing nil values
Radar 19747372
---------------------------------------------------------------------------------------
The obj-c literal syntax for dictionaries does not allow nils.
@{key : nil}; // Exception (and compiler error)
@swillits
swillits / gist:c178206f0cdf362501c5
Last active August 29, 2015 14:14
Yosemite, GL Core Profile Extensions list
GL_ARB_blend_func_extended
GL_ARB_draw_buffers_blend
GL_ARB_draw_indirect
GL_ARB_ES2_compatibility
GL_ARB_explicit_attrib_location
GL_ARB_gpu_shader_fp64
GL_ARB_gpu_shader5
GL_ARB_instanced_arrays
GL_ARB_internalformat_query
GL_ARB_occlusion_query2
[9:21pm] swillits: ThemsAllTook: here's my impression
[9:21pm] swillits: And you may have data to support some of this
[9:23pm] swillits: For a long time you didn't do anything but minecraft videos. I for one was surprised by the number of subscribers you got from those, just based on the fact that there were 50,000 other people doing the same thing at the time.
[9:23pm] swillits: After you did MC you did some other games, mostly serially in bulk.
[9:24pm] swillits: So the vast majority of your videos are about a relatively small number of games
[9:25pm] swillits: 34 terraria, easily over 150 are minecraft, 12 NecroDancer, 44 spelunky, etc
[9:26pm] swillits: That's a huge amount of content about very few things. The number of people who are going to watch *all* of those, is probably really really really really small. Most are only going to care about one of those games, and maybe watch several o f those videos.
[9:26pm] swillits: Compared to, like you said, doing one video each on 300 different games.
[9:27pm