Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat
Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.
// Copyright (c) 2019–20 Adam Sharp and thoughtbot, inc. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
# Paste these lines into your ~/.bashrc or other shell initialisation script | |
# Note that for most of these, your gitconfig has to have the aliasses from the .gitconfig in this gist | |
alias co='git checkout' | |
alias st='git status' | |
alias add='git add' | |
alias commit='git commit' | |
# Amend anything that is staged |
Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat
Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.
#!/usr/bin/swift | |
// Run: $ swift noCrashplan.swift | |
// Background: https://github.com/KrauseFx/overkill/issues/3#issuecomment-270505227 | |
import Foundation | |
import Cocoa | |
import ServiceManagement | |
let badApps = [ "Code42 CrashPlan", "CrashPlanService", "CrashPlanLauncher", "CrashPlanWeb" ] |
@interface NSObject (Debounce) | |
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay; | |
@end |
typedef NSCachedURLResponse * (^WGNCachedResponseBlock)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse); | |
- (WGNCachedResponseBlock)cacheResponseBlockWithTime:(NSTimeInterval)time { | |
return ^NSCachedURLResponse *(NSURLConnection *connection, NSCachedURLResponse *cachedResponse) { | |
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)[cachedResponse response]; | |
NSDictionary *headers = [httpResponse allHeaderFields]; | |
NSString *cacheControl = [headers valueForKey:@"Cache-Control"]; | |
NSString *expires = [headers valueForKey:@"Expires"]; | |
if((cacheControl == nil) && (expires == nil)) { |
When you have two objects A and B, say two view controllers, that you want to have talk to each other, you can choose from the following options:
NSNotificationCenter. This is anonymous one-to-many communication. Object A posts a notification to the NSNotificationCenter, which then distributes it to any other objects listening for that notification, including Object B. A and B do not have to know anything about each other, so this is a very loose coupling. Maybe a little too loose...
KVO (Key-Value Observing). One object observes the properties of another. This is a very tight coupling, because Object B is now peeking directly into Object A. The advantage of KVO is that Object A doesn't have to be aware of this at all, and therefore does not need to send out any notifications -- the KVO mechanism takes care of this behind the scenes.
Direct pointers. Object A has a pointer to Object B and directly sends it messages when something of interest h
HOW DUZ I QSORT YR DATA AN YR BEGIN AN YR END | |
END PWNS BEGIN | |
O RLY? | |
YA RLY | |
GTFO | |
OIC | |
I HAS PIVOT AN LEFT AN RIGHT AN TEMP | |
PIVOT R NMBR BEGIN OF DATA | |
LEFT R SUM OF BEGIN AN 1 | |
RIGHT R END |
#!/bin/sh | |
projectfile=`find -d . -name 'project.pbxproj'` | |
projectdir=`echo *.xcodeproj` | |
projectfile="${projectdir}/project.pbxproj" | |
tempfile="${projectdir}/project.pbxproj.out" | |
savefile="${projectdir}/project.pbxproj.mergesave" | |
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile | |
cp $projectfile $savefile |
dispatch_block_t RecursiveBlock(void (^block)(dispatch_block_t recurse)) | |
{ | |
// assuming ARC, so no explicit copy | |
return ^{ block(RecursiveBlock(block)); }; | |
} | |
typedef void (^OneParameterBlock)(id parameter); | |
OneParameterBlock RecursiveBlock1(void (^block)(OneParameterBlock recurse, id parameter)) | |
{ |