Skip to content

Instantly share code, notes, and snippets.

@mcany
mcany / .gitconfig
Last active August 10, 2016 13:44 — forked from salimkayabasi/.gitconfig
[user]
email = mcanyigin@gmail.com
name = Mertcan YIGIN
[core]
autocrlf = true
editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin
[color]
diff = auto
status = auto
branch = auto
language: objective-c
osx_image: xcode8
sudo: true
before_install:
# There is a bug in travis. When using system ruby, bundler is not
# installed and causes the default install action to fail.
- gem install bundler
- brew install graphicsmagick
script:
- ./scripts/travis.sh
#!/bin/sh
git fetch --unshallow
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" == "development" ]; then
bundle exec fastlane upload env:sandbox type:appstore
bundle exec fastlane upload env:sandbox type:adhoc
echo Uploading build log...
curl -T ./build/logs/KapGelSandbox-KapGel\ Sandbox.log chunk.io
elif [ "$TRAVIS_BRANCH" == "master" ]; then
@property (copy, nullable) NSString *name;
@property (copy, readonly, nonnull) NSArray *allItems;
- (nullable AAPLListItem *)itemWithName:(nonnull NSString *)name;
- (NSInteger)indexOfItem:(nonnull AAPLListItem *)item;
- (void)pulseAnimationTo:(UIView *)view duration:(float)duration toValue:(float)toValue repeatCount:(float)repeatCount {
CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
pulseAnimation.duration = duration;
pulseAnimation.toValue = [NSNumber numberWithFloat:toValue];
pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
pulseAnimation.autoreverses = YES;
pulseAnimation.repeatCount = repeatCount;
[view.layer addAnimation:pulseAnimation forKey:nil];
}
extension Bool {
init<T : IntegerType>(_ integer: T) {
if integer == 0 {
self.init(false)
} else {
self.init(true)
}
}
}
The final interface is as simple as this:
image.scaled(to: size)
image.scaled(to: size, scalingMode: .aspectFill)
image.scaled(to: size, scalingMode: .aspectFit)
.. and is implemented like this:
// MARK: - Image Scaling.
extension UIImage {
#bin/bash
set -e
set -o pipefail
# Run SwiftLint
START_DATE=$(date +"%s")
SWIFT_LINT=/usr/local/bin/swiftlint
SWIFT_LINT_YAML=.swiftlint.yml
@mcany
mcany / gist:3c517c9327cf23a832980b8d38ba6152
Created September 18, 2020 12:03
lipo framwork extract
FRAMEWORK="${TARGET_BUILD_DIR}/${WRAPPER_NAME}/Frameworks/**.framework"
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
@mcany
mcany / app.dart
Last active May 27, 2021 04:23
New Flutter Project with Bloc
export 'app_bloc.dart';
export 'app_event.dart';
export 'app_state.dart';
export 'app_route.dart';