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
import { Controller } from "@hotwired/stimulus"; | |
export default class ApplyCssController extends Controller { | |
static targets = ["element"]; | |
static values = { | |
selector: String, | |
onConnect: { type: Boolean, default: false }, | |
}; |
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/bash | |
# Generate a `:something-wow:` Slack emoji | |
# With thanks to https://gist.github.com/briancain/2efe69b8870be01bafde829d3933b2d3 | |
set -euo pipefail | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 input.png" | |
exit 1 |
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
// | |
// SGBtvOSMotionEffect.m | |
// | |
// Created by Simon Booth on 11/09/2015. | |
// Copyright © 2015 agbooth.com. All rights reserved. | |
// | |
#import "SGBtvOSMotionEffect.h" | |
@implementation SGBtvOSMotionEffect |
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
@implementation DTMutableCoreTextLayoutFrame | |
{ | |
NSUInteger _numberOfDrawingOperationsInParallel; | |
NSConditionLock *_lock; | |
} | |
- (void)_incDrawingOperations | |
{ | |
[_lock lock]; | |
_numberOfDrawingOperationsInParallel++; |
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
- (NSArray *)windowsWithKeyWindow | |
{ | |
NSMutableArray *windows = self.windows.mutableCopy; | |
UIWindow *keyWindow = self.keyWindow; | |
if ([windows containsObject:keyWindow]) { | |
[windows removeObject:keyWindow]; | |
} | |
[windows insertObject:keyWindow atIndex: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
NSInteger numberOfIntervals; | |
double leftPowerOfTen = pow(10, floor(log10(maximumLeft))); | |
double leftMultipleOfPowerOfTen = maximumLeft / leftPowerOfTen; | |
// round the maximum left up to something nice | |
if (leftMultipleOfPowerOfTen < 1.25) | |
{ | |
maximumLeft = leftPowerOfTen * 1.25; | |
numberOfIntervals = 5; |