Skip to content

Instantly share code, notes, and snippets.

Umut ADALI kobeumut

Block or report user

Report or block kobeumut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View country-bounding-boxes.json
[
{ "code":"AF", "country" : "Afghanistan", "bound": [60.53, 29.32, 75.16, 38.49] },
{ "code":"AO", "country" : "Angola", "bound": [11.64, -17.93, 24.08, -4.44] },
{ "code":"AL", "country" : "Albania", "bound": [19.3, 39.62, 21.02, 42.69] },
{ "code":"AE", "country" : "United Arab Emirates", "bound": [51.58, 22.5, 56.4, 26.06] },
{ "code":"AR", "country" : "Argentina", "bound": [-73.42, -55.25, -53.63, -21.83] },
{ "code":"AM", "country" : "Armenia", "bound": [43.58, 38.74, 46.51, 41.25] },
{ "code":"AQ", "country" : "Antarctica", "bound": [-180.0, -90.0, 180.0, -63.27] },
{ "code":"TF", "country" : "French Southern Territories", "bound": [68.72, -49.78, 70.56, -48.63] },
{ "code":"AU", "country" : "Australia", "bound": [113.34, -43.63, 153.57, -10.67] },
@kobeumut
kobeumut / setup_digitalocean_rails.md
Created May 10, 2019 — forked from newmetl/setup_digitalocean_rails.md
Setup a Droplet on Digital Ocean for Rails with Nginx, Passenger and Postgresql
View setup_digitalocean_rails.md

Setup new Server

This setup guide was created with the following components:

  • DigitalOcean Droplet (Ubuntu 16.04.4 x64)
  • Postgresql 9.5
  • Nginx + Passenger
  • Rails 5.2
  • Ruby 2.4.1
@kobeumut
kobeumut / ObserveOnceExtension.kt
Created Apr 21, 2019
Android Livedata Observe Once Only (Kotlin)
View ObserveOnceExtension.kt
fun <T> LiveData<T>.observeOnce(lifecycleOwner: LifecycleOwner, observer: Observer<T>) {
observe(lifecycleOwner, object : Observer<T> {
override fun onChanged(t: T?) {
observer.onChanged(t)
removeObserver(this)
}
})
}
//Using
liveData.observeOnce(this, Observer<Password> {
@kobeumut
kobeumut / mutablelivedata.md
Created Apr 20, 2019 — forked from humblehacker/mutablelivedata.md
Don't expose MutableLiveData
View mutablelivedata.md
@kobeumut
kobeumut / Crypt.java
Created Mar 20, 2019
AES128 CBC mode in Java, Kotlin and Ruby
View Crypt.java
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
public class Encryptor {
public static String encrypt(String key, String initVector, String value) {
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
View installing_rmagick_ubuntu_16.04.txt
# the instructions from here: https://stackoverflow.com/questions/3704919/installing-rmagick-on-ubuntu/31089915#31089915
# worked, but only after I added in line 8
sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
gem install rmagick
View tableview-dynamic-height.swift
override func viewDidAppear(_ animated: Bool) {
var frame = tableView.frame
frame.size.height = tableView.contentSize.height
tableView.frame = frame
tableviewHeightConstraint.constant = tableView.contentSize.height
}
@kobeumut
kobeumut / String-To-Price-Extension.swift
Created Apr 5, 2018
You are printing a number not a string Xcode 9 • Swift 4
View String-To-Price-Extension.swift
extension String {
var twoFractionDigits: String {
let styler = NumberFormatter()
styler.minimumFractionDigits = 2
styler.maximumFractionDigits = 2
styler.numberStyle = .currency
let converter = NumberFormatter()
converter.decimalSeparator = "."
if let result = converter.number(from: self) {
return styler.string(for: result) ?? ""
View Swift-UIScrollView-Image-Slider.swift
//
// AdDetailVC.swift
//
//
// Created by GriSoft Mobile on 31.03.2018.
// Copyright © 2018 All rights reserved.
//
import UIKit
@kobeumut
kobeumut / NSDecimalNumber.swift
Created Mar 29, 2018
String to NSDecimalNumber in Swift 3
View NSDecimalNumber.swift
let formatter = NumberFormatter()
formatter.generatesDecimalNumbers = true
formatter.numberStyle = NumberFormatter.Style.decimal
if let formattedNumber = formatter.number(from: textValue) as? NSDecimalNumber {
xa = formattedNumber
}
You can’t perform that action at this time.