This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ease(p) { | |
p *= 5; | |
if (p < 1) { | |
return (-0.9 * Math.cos(p * (Math.PI / 2)) + 0.9 + (0.1 * p)) * 0.3; | |
} else { | |
p = ((p - 1) / 4); | |
var p1 = p - 1; | |
return (((p1 * p1 * p1 + 1) * 0.9) + p * 0.1) * 0.7 + 0.3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fade Ins: | |
// Linear: | |
for (let i = 0; i < length; i++) { | |
array[i] = i / length; | |
} | |
// Exponential, Concave Up: | |
let silence = Math.pow(10.0, -120.0 / 20.0); // Silence is -120dB | |
let fromValue = silence; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IFS=$'\n' | |
FORCE=0 | |
compress_png () { | |
more_args="" | |
# Note: I use an "og_" prefix on a file to indicate "opaque and grayscale", | |
# "g_" for grayscale, and "o_" for opaque. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IFS=$'\n' | |
FORCE=0 | |
compress_png () { | |
more_args="" | |
if [[ $1 = og_* ]]; then | |
more_args="-c 0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
When MTSDebugTouchEvents() is called, -[UIApplication sendEvent:] will flash | |
the views which receive touch events. | |
*/ | |
@implementation UIApplication (MTSDebug) | |
- (void) mts_sendEvent_highlightTouches:(NSArray *)touches | |
{ | |
static NSMutableDictionary *sViewToWindowMap = nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Due to a change with the App Sandbox, Pixel Winch 1.1 cannot capture screenshots | |
# in the beta version of macOS Sierra. As a workaround until Sierra GM, run the below commands. | |
# | |
# For more information, if you are a third party developer, check out: | |
# https://eternalstorms.wordpress.com/2016/08/01/screencapture-and-the-sandbox-in-macos-sierra/ | |
# https://forums.developer.apple.com/message/152226#152226 | |
# | |
# If you are an Apple engineer, check out: | |
# 27245600, 27610157, 27735823 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I tried to migrate to the non-MAS version of Sketch and had problems. | |
Steps I took: | |
1) I launched New Sketch. I entered my e-mail address. No e-mail received. | |
2) I launched MAS Sketch. It crashed at launch and told me the app was damaged. | |
3) Ok, no problem, I trashed the app and reinstalled from the MAS's purchases tab | |
4) Download appeared in /Applications. When MAS got to 100%, download disappeared. I've seen this before with MAS software. | |
5) I had to trash the new version of Sketch as well, *and* empty trash. | |
6) Re-download from the MAS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "json" | |
all_strings = [ ] | |
`find . -path "*en.lproj*/*.strings"`.each_line do |line| | |
JSON.parse(`plutil -convert json -o - \"#{line.chop}\"`).each_value do |value| | |
all_strings.push(value.strip) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to push a portrait-only UIViewController onto a landscape UINavigationController | |
- (void) _presentForcedVerticalNormalViewController:(UIViewController *)viewController animated:(BOOL)animated | |
{ | |
UIView *(^makeSnapshotOfViewController)(UIViewController *) = ^(UIViewController *vc) { | |
UIView *result = [[vc view] snapshotViewAfterScreenUpdates:NO]; | |
[[_rootViewController view] addSubview:result]; | |
[result setFrame:[[vc view] bounds]]; | |
[result setUserInteractionEnabled:NO]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IXDebugTouchEvents() will flash the view that receives a touch event | |
BOOL IXSwizzleMethod(Class cls, SEL selA, SEL selB) | |
{ | |
Method methodA = class_getInstanceMethod(cls, selA); | |
if (!methodA) return NO; | |
Method methodB = class_getInstanceMethod(cls, selB); | |
if (!methodB) return NO; |