Skip to content

Instantly share code, notes, and snippets.

View itod's full-sized avatar

Todd Ditchendorf itod

View GitHub Profile
@itod
itod / ars_header.css
Created October 16, 2014 13:29
Ars Technica Fixed Position Header Fix
#masthead, #primary, .nav-fixed {position:static !important;}
@itod
itod / confinement.java
Last active August 29, 2015 14:10
Java Confinement
// MyClass.property is confined. may only be get or set on the main thread.
// Wo the `property` member is not thread-safe, but the code
// overall *is* thread safe if you confine access to `property` to the main thread only
public class MyClass {
private Object property;
public void action() {
assert isMainThread();
@itod
itod / CanvasCenter.m
Last active August 29, 2015 14:10
Some View-centering code for a Canvas in an NSScrollView
BOOL TDSizeContainsSize(CGSize s1, CGSize s2) {
return s1.width >= s2.width && s1.height >= s2.height;
}
CGRect TDSquareAroundPoint(CGPoint p, CGFloat side) {
CGRect r = CGRectMake(p.x - side*0.5, p.y - side*0.5, side, side);
return r;
}
@itod
itod / fluidapp_default_prefs.txt
Last active November 21, 2016 03:15
Altering FluidApp default user preferences
This should be possible by cracking open Fluid.app (Fluid itself, not Fluid apps you create, mind you), and editing this config file:
Fluid.app/Contents/Resources/FluidApp.app/Contents/Resources/FluidApp-DefaultValues.plist
All of the default user defaults (aka user preferences) are stored here. Subsequent Fluid Apps created by this Fluid.app instance will have these default preferences.
@itod
itod / tryfinally
Created June 19, 2015 19:09
Try/Finally with no exceptions in sight.
//
// main.m
// Finally
//
// Created by Todd Ditchendorf on 6/19/15.
// Copyright (c) 2015 Todd Ditchendorf. All rights reserved.
//
#import <Foundation/Foundation.h>
@itod
itod / gist:ae269e123cf94e42ccff
Created June 19, 2015 19:52
Try/finally cleaner than multiple gotos with label?
void myfunc() {
void *thing1 = NULL;
void *thing2 = NULL;
@try {
thing1 = allocThing1();
if (!thing1) return;
// …use thing1 maybe
@itod
itod / run_fake_workflows_in_folder.applescript
Created February 5, 2016 19:41
Runn all Fake Workflows in a Folder
tell application "Finder"
set path_ to (get path to desktop as string) & "workflows"
set dir_ to folder path_
set ext_ to "fakeworkflow"
set files_ to items of dir_ whose name of it ends with ext_
tell application "Fake"
repeat with file_ in files_
--display dialog (get title of file_)
open file_
@itod
itod / sierra_question_mark
Created November 21, 2016 19:12
Sierra: Fluid Apps Show Question Mark in Dock
I think I know what’s going wrong. On Sierra, if an app has not been manually dragged into the "Applications" folder by the user, then the app cannot be successfully "kept" in the Dock. This is a new "security feature" of some kind from Apple.
This has something to do with App Translocation: http://lapcatsoftware.com/articles/app-translocation.html
Or path randomization: http://mjtsai.com/blog/2016/06/16/gatekeeper-path-randomization/
So you should remove the Question Mark from the Dock, quit the Fluid App you created, drag your Fluid App to your "Applications" folder (you may have to drag it *out* first), relaunch it and try again.
Thanks,
@itod
itod / split_keyboards.md
Last active March 11, 2026 10:58
Every "split" mechanical keyboard currently being sold that I know of
@itod
itod / 6.5.5_download_problem.txt
Last active February 20, 2017 02:37
1Password 6.5.5 Download Problem Bug Report
SUMMARY
------------------
Downloading 1Password 6.5.5 for Mac leads to Chrome malware warnings.
SETUP
------------------
Device: Mac mini (Late 2014)
OS: 10.12.2 (16C67), Language set to "German" (that's somewhat unusual, so I thought I'd mention it)
Browser: Google Chrome Version 57.0.2987.54 beta (64-bit)