Skip to content

Instantly share code, notes, and snippets.

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

Fadime Özhan fadimezhan

🏠
Working from home
View GitHub Profile
@fadimezhan
fadimezhan / rails http status codes
Created June 17, 2022 14:02 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
require 'apple_id'
# NOTE: in debugging mode, you can see all HTTPS request & response in the log.
# AppleID.debug!
pem = <<-PEM
-----BEGIN PRIVATE KEY-----
:
:
-----END PRIVATE KEY-----
@fadimezhan
fadimezhan / !README.MD
Created February 17, 2021 12:19 — forked from davideluque/!README.MD
Sign in with Apple in Ruby on Rails using apple_id gem.

Implementation of the Sign in with Apple service in Ruby on Rails. This implementation is convenient for Ruby on Rails APIs as it does not use views.

This implementation does:

  • Verify the user's identity token with apple servers to confirm that the token is not expired and ensure it has not been tampered with or replayed to the app.
  • Log in the user, register the user or connect the user's apple account to the user's existing account.

Parameters

  • code: Apple's authorizationCode after sign in. Example: c49a75458b1e74b9f8e866f5a93b1689a.0.nrtuy. ...
@fadimezhan
fadimezhan / MFBadgeButton
Created September 21, 2020 12:06 — forked from moflo/MFBadgeButton
Swift add badge to UIButton - MFBadgeButton.swift
class MFBadgeButton : UIButton {
var badgeValue : String! = "" {
didSet {
self.layoutSubviews()
}
}
override init(frame :CGRect) {
@fadimezhan
fadimezhan / info.md
Created September 16, 2020 10:57 — forked from vilusa/info.md
Xcode iPhone USB disconnect problem resolve

Run terminal below commands

$ sudo pkill usbmuxd
$ sudo killall -STOP -c usbd
```
@fadimezhan
fadimezhan / ios-how-to-communicate-with-iframes.md
Created July 9, 2020 14:16 — forked from wayne5540/ios-how-to-communicate-with-iframes.md
This article is to show how to inject JavaScript into iframs under iOS web view and so we can communicate with it.

[iOS - Swift] How to communicate with iFrames inside WebView

To provide better shopping experience for Onefill users, we want to support as many shopping site as we can by injecting our JavaScript engine into those sites. However, some of them are using iframe which is outdated HTML tag to implement some forms like payment and signup. And due to security issue JavaScript can’t communicate with iframe unless it’s same domain or it’s your domain. So here is the approach we did to support iframe under iOS web view and so we can communicate with it.

  • Xcode: Version 8.2.1 (8C1002)
  • Swift: Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)

Conclusion first

@fadimezhan
fadimezhan / rails_admin.tr.yml
Created June 24, 2020 12:25 — forked from paracycle/rails_admin.tr.yml
Rails Admin Turkish translation
tr:
admin:
home:
name: "Anasayfa"
pagination:
previous: "&laquo; Önceki"
next: "Sonraki &raquo;"
truncate: "…"
misc:
filter_date_format: "dd/mm/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done!
@fadimezhan
fadimezhan / application_helper.rb
Created January 22, 2020 11:02
Turbolink action set for rails links
def remote_visit_data(turbolinks_action = '')
{ data: { action: 'click->remote#visit', turbolinks_action: turbolinks_action } }
end
### usage
### %a{ href: restaurant_orders_path, **remote_visit_data('restore') }
### = link_to some_path, class: 'nav-link', **remote_visit_data('restore')
@fadimezhan
fadimezhan / window-resize-buffer-throttle.js
Created October 24, 2019 12:26 — forked from davesmiths/window-resize-buffer-throttle.js
Buffer/Throttle triggered events (js)
var delay = 200
,run
,runBuffer
;
run = function() {
console.log('resize event fired');
};
// Prevent unnecessary calls to run
@fadimezhan
fadimezhan / gist:e4bf460d1d3c9db4f5ef808c47bdda17
Created April 29, 2019 07:28 — forked from allex/gist:1880618
Hide the iOs soft keyboard
/* vim: set ft=javascript: */
// Javascript: Hide the iOS soft keyboard
//
// http://uihacker.blogspot.com/2011/10/javascript-hide-ios-soft-keyboard.html
// http://stackoverflow.com/questions/5937339/ipad-safari-make-keyboard-disappear
// -------------------------------------------------------------------------------
// I was having some trouble getting my text input field to relieve itself of focus on the
// iPhone, and after a little searching, I came up with a couple options. It's pretty
// self-explanatory. The 2nd line will de-focus all input fields, and it relies on jQuery.