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 / Extension.swift
Created February 10, 2018 19:21
Add Placeholder Swift 4 - iOS
import UIKit
extension UITextView: UITextViewDelegate {
override open var bounds: CGRect {
didSet {
self.resizePlaceholder()
}
}
public var placeholder: String? {
@kobeumut
kobeumut / link_to.html.erb
Created January 12, 2018 13:09
If you want to use href instead of link to. It's equivalent link_to in Rails. And if you want to use method you must use data-method in a tag
@kobeumut
kobeumut / rails_server_helper.bash
Last active January 11, 2018 14:01 — forked from waiting-for-dev/rails_server_helper.bash
Stop and restart easily a rails server.
function rails() {
if [ "$1" = "start" ]; then
if [ "$2" = "" ]; then
RENV="production"
else
RENV="$2"
fi
rails server -p 80 -b 0.0.0.0 -d -e "$RENV"
return 0
elif [ "$1" = "stop" ]; then
@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
@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 / jquery-remove-options-selectbox.html
Created January 5, 2018 10:49
Delete all option except first in JQUERY
<select id="domain" name="domain_name" class="form-group form-control">
<option id="first_domain" value="" selected disabled>Alan Adı</option>
<option>Deneme Değeri</option>
<option>Sample Value</option>
<option>Third Sample Value</option>
</select>
<script>
$('#domain').change(function () {
@kobeumut
kobeumut / gist:00908c5d52dcdf856e5fddf050a3d475
Created December 21, 2017 08:38 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@kobeumut
kobeumut / activeadmin_add_user_references_to_company.rb
Last active December 21, 2017 05:45
Ruby on rails add user references to company and display an email instead of an object in active admin
ActiveAdmin.register Company do
permit_params :user_id, :name ## Add this line
form do |f|
f.inputs "Admin Details" do
f.input :user_id, as: :select, collection: User.all.map { |a| [a.email, a.id] }
f.input :name
f.actions
require 'rufus-scheduler'
require 'uri'
require 'net/http'
require 'openssl'
require 'json'
def getir
url = URI("https://koineks.com/ticker")
http = Net::HTTP.new(url.host, url.port)
@kobeumut
kobeumut / embedded-file-viewer.md
Created December 17, 2017 19:06 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links