Skip to content

Instantly share code, notes, and snippets.

View sergii-frost's full-sized avatar
💭
¯\_(ツ)_/¯

Sergii sergii-frost

💭
¯\_(ツ)_/¯
  • Stockholm, Sweden
View GitHub Profile
@sergii-frost
sergii-frost / HeaderItemDecoration.kt
Created August 8, 2019 08:33 — forked from filipkowicz/HeaderItemDecoration.kt
Item Decorator for sticky headers in Kotlin
/*
solution based on - based on Sevastyan answer on StackOverflow
changes:
- take to account views offsets
- transformed to Kotlin
- now works on viewHolders
- try to cache viewHolders between draw's

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-completions & zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-completions by
@sergii-frost
sergii-frost / ValidatableEditText.java
Created September 19, 2017 12:45
Validatable Edit Text
import android.content.Context;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@sergii-frost
sergii-frost / FRButton Usage.md
Last active August 2, 2017 14:02
Swift: Button with closures as actions
let button = FRButton()

button.touchDownAction = {(button: FRButton) in
  print("button touchDownAction")
}

button.touchUpAction = {(button: FRButton) in
  print("button touchUpAction")
}
@sergii-frost
sergii-frost / git-best-practices.md
Created July 25, 2017 14:25
Git best practices

It makes much easier to switch between different git projects if we try to follow similar rules for commits, branches and other git related stuff.

So, based on best practices used in different mobile projects we've come to some basic rules:

Git commits prefixes:

We are trying to make it easy to read commits history. To make commits look similar in different project / from different people some best practices can be applied:

  • adding prefix to commit:
//: Playground - noun: a place where people can play
import UIKit
//
// NSDate+Compare.swift
// Node
//
// Created by Sergii Frost on 2017-06-13.
// Copyright © 2017 Rebtel. All rights reserved.
@sergii-frost
sergii-frost / PulseView.playground
Created December 22, 2016 17:39
Pulse View playground
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
let kStartAlpha: CGFloat = 0.8
let kEndAlpha: CGFloat = 0.0
let kDuration: CFTimeInterval = 1.0
let bgColor = UIColor(red: 153.0/255, green: 192.0/255, blue: 204.0/255, alpha: 1.0)
@sergii-frost
sergii-frost / NSMutableAttributedString.swift
Created November 22, 2016 09:42
NSMutableAttributedString (Swift) Playground
//: Playground - noun: a place where people can play
import UIKit
let creator = "Awesome Me"
let teamName = "Awesome Team"
let groupName = "Awesome Group"
func getHeader(creator: String, team: String, group: String? = nil) -> NSAttributedString {
@sergii-frost
sergii-frost / DateHelperPlaygound.playground
Created November 8, 2016 21:31
DateHelper playground
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, Date Helper playrgound!"
//Returns the first date of the current year. Should return the following timestamp for the year 2016: 1451606400
func getFirstDateOfCurrentYear() -> NSNumber {
//Get current year