Skip to content

Instantly share code, notes, and snippets.

@polok
polok / bash
Created Jul 22, 2019
[Git] Empty commit
View bash
$ git commit --allow-empty -m "Empty message"
@polok
polok / brew_switch_swiftformat
Last active Jul 15, 2019
Swiftformat version switch using brew
View brew_switch_swiftformat
brew switch swiftformat XXX
Before above check that you have requested swiftformat version. In my case it was here:
/usr/local/Cellar/swiftformat
Example:
brew switch swiftformat 0.37.5
@polok
polok / file.swift
Created Jan 12, 2017
Small function to rotate the image clockwise or counterclockwise
View file.swift
func rotate(image: UIImage, clockwise: Bool) -> UIImage {
var rotatedImage: UIImage?
let rotateSize = CGSize(width: image.size.height, height: image.size.width)
UIGraphicsBeginImageContextWithOptions(rotateSize, false, 1.0)
guard let context = UIGraphicsGetCurrentContext() else {
return image
}
@polok
polok / shadow.xml
Last active Nov 15, 2016
[Android] Elevation on Pre-lollipop Devices
View shadow.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@android:color/transparent"
android:endColor="#44000000"
android:angle="90"/>
</shape>
You can’t perform that action at this time.