Skip to content

Instantly share code, notes, and snippets.

View kobeumut's full-sized avatar
🏠
Working from home

Umut ADALI kobeumut

🏠
Working from home
View GitHub Profile
@kobeumut
kobeumut / .gitlab-ci.yml
Created October 30, 2019 18:55
deploy rails with ssh
before_script:
- apt-get update -qq
- apt-get install -qq git
##
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
##
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
##
@kobeumut
kobeumut / SimpleParsingJson.swift
Created January 5, 2018 19:01
Simple Fetch Url and Parse Json on Swift 4 with codable and URLSession
func fetchResultsFromApi() {
struct MyGitHub: Codable {
let name: String?
let location: String?
let followers: Int?
let avatarUrl: URL?
let repos: Int?
private enum CodingKeys: String, CodingKey {
@kobeumut
kobeumut / Apps.rb
Created January 11, 2018 05:37
Exclude some columns on ActiveAdmin
ActiveAdmin.register App do
ActionController::Parameters.permit_all_parameters = true
menu priority: 6, label: "Uygulamalar"
index do
selectable_column
excluded = ["app_image","updated_at","domain_id"]
(App.column_names - excluded).each do |c|
column c.to_sym
end
[
{ "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 06:04 — forked from newmetl/setup_digitalocean_rails.md
Setup a Droplet on Digital Ocean for Rails with Nginx, Passenger and Postgresql

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 / mutablelivedata.md
Created April 20, 2019 21:05 — forked from humblehacker/mutablelivedata.md
Don't expose MutableLiveData
@kobeumut
kobeumut / installing_rmagick_ubuntu_16.04.txt
Created March 18, 2019 09:49 — forked from ryderstorm/installing_rmagick_ubuntu_16.04.txt
Installing rmagick gem on Ubuntu 16.04
# 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
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 April 5, 2018 12:25
You are printing a number not a string Xcode 9 • Swift 4
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) ?? ""
//
// AdDetailVC.swift
//
//
// Created by GriSoft Mobile on 31.03.2018.
// Copyright © 2018 All rights reserved.
//
import UIKit