Skip to content

Instantly share code, notes, and snippets.

View MaximBazarov's full-sized avatar
💤
ZEN

Maxim Bazarov MaximBazarov

💤
ZEN
View GitHub Profile
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
@MaximBazarov
MaximBazarov / pdf_72_resize.sh
Created April 26, 2017 10:06
PDF 72x72 resize
#!/usr/bin/env bash
echo "PDF Resize"
echo "Usage: $0 input-image.pdf output-image.pdf 100x100"
if [ $# -eq 0 ]; then
echo "No arguments provided"
exit 1
fi
gs -o $2 -sDEVICE=pdfwrite -dPDFFitPage -r72x72 -g$3 $1
#!/usr/bin/perl
# HOW TO USE:
# script suppose to run as one of the build phases in a Xcode project
# (For example like this: ${SOURCE_ROOT}/scripts/check_strings.pl ${PRODUCT_NAME})
# HOW IT WORKS
# script parse the Localizable file for the specific target (get target name from parameter ${PRODUCT_NAME})
# and .m files in the project (except KDSLocalization.m)
# script generates xcode error messages during a build process
language: objective-c
osx_image: xcode9.3
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- WORKSPACE=Ronald.xcworkspace
- IOS_SCHEME="Ronald"
matrix:
- DESTINATION="OS=11.3,name=iPhone X" SCHEME="$IOS_SCHEME" RUN_TESTS="YES"
enum Auth {
struct TokenWasObtained: Action {
let token: String
}
}
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
core.dispatch(action: Auth.TokenWasObtained(
token: fcmToken)
)
}
func downloadProfileImage(_ url: URL) {
// I've skipped action creator here, just to keep it short
let action = Downloader.DownloadProfileImage(url: url)
core.dispatch(action: action)
}
func downloadFinished(_ image: UIImage) {
let action = ProfileImageDownloaded(image: image)
core.dispatch(action: action)
}
func reduce(_ old: AuthState, with action: Action) -> AuthState {
switch action {
case let payload as Auth.TokenWasObtained:
return AuthState(id: old.id,
token: payload.token
)
default: return old
}
}
struct DownloadUserProfile: Action {
let baseURL: String
let endpoint: String
let profileID: String
let authToken: String
let retryCount: Int
}