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 / KeyboardDetectingLayout.java
Created February 20, 2015 07:57
Example of custom Layout which allows to detect if soft keyboard is visible
public class KeyboardDetectingLayout extends RelativeLayout {
private boolean isSoftKeyboardVisible;
public KeyboardDetectingLayout(Context context) {
super(context);
this.isSoftKeyboardVisible = false;
}
public KeyboardDetectingLayout(Context context, AttributeSet attrs) {
@sergii-frost
sergii-frost / LocalyticsPushContent.java
Created March 17, 2015 22:26
LocalyticsPushContent
import android.os.Bundle;
public class LocalyticsPushContent {
private String externalUrl;
private String title;
private String message;
public static final String EXTRAS_PUSH_TITLE = "title";//Expected default value from Localytics
public static final String EXTRAS_PUSH_MESSAGE = "message";//Expected default value from Localytics
@sergii-frost
sergii-frost / Xcode Problem Report
Created April 2, 2015 12:26
XCActionBar + CocoaPods plugins crash
Process: Xcode [14851]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 6.2 (6776)
Build Info: IDEFrameworks-6776000000000000~11
App Item ID: 497799835
App External ID: 811890240
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [14851]
@sergii-frost
sergii-frost / TriangleView.java
Created April 21, 2015 18:23
Triangle View (Android)
package se.snezdoliy.gist;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
@sergii-frost
sergii-frost / iOS_Jenkins_job.sh
Created May 26, 2015 11:21
Regular CI job for iOS
#1. Init basic variables
APP_NAME="MyCoolApp"
PROJECT_DIR=$(PWD)/${APP_NAME}
BUILD_DIR=${PROJECT_DIR}/build
EXECUTABLE_NAME="MyCoolApp"
INFO_PLIST_FILE="${PROJECT_DIR}/${APP_NAME}/Info.plist"
#Need to get last commit information from Git repo.
git_notes=`git log -3 --pretty=format:'h by %an on %aD >> %s\n'`
commits_count=`git rev-list HEAD --count`
@sergii-frost
sergii-frost / KeyboardDetectingLayout.java
Created June 4, 2015 08:06
Android: KeyboardDetectingLayout
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class KeyboardDetectingLayout extends RelativeLayout {
private boolean isSoftKeyboardVisible;
public KeyboardDetectingLayout(Context context) {
super(context);
@sergii-frost
sergii-frost / ImageUtils.java
Last active October 26, 2015 15:08
Image Utils to deal with rotated images when using android-crop library
package com.application.hunting.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
enum WeekDays: Int {
case Sunday = 1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
var name: String {
switch self {
case .Monday: return "Mon"
case .Tuesday: return "Tue"
case .Wednesday: return "Wed"
case .Thursday: return "Thu"
case .Friday: return "Fri"
@sergii-frost
sergii-frost / UIAlertController+UIDatePicker.m
Created August 17, 2016 11:56
UIAlertController + UIDatePicker
+ (RACSignal *) showDatePickerInController:(UIViewController *)parentViewController
title:(NSString *)title
startDate:(NSDate *)startDate
endDate:(NSDate *)endDate
dismissButton:(NSString *)dismissButtonTitle
actionButton:(NSString *)actionButtonTitle {
return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
message:@"\n\n\n\n\n\n\n\n\n"
preferredStyle:UIAlertControllerStyleActionSheet];
@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