Skip to content

Instantly share code, notes, and snippets.

Štefan Ľupták EskiMag

Block or report user

Report or block EskiMag

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 string_extensions.rb
class String
# "Příšerně žluťoučký kůň úpěl ďábelské ódy".strip_diacritics =>
# "Priserne zlutoucky kun upel dabelske ody"
def strip_diacritics
self.mb_chars.normalize(:kd).to_s.gsub(/[^\x00-\x7F]/, '')
# Little hacks to allow using also decimal comma (used in EU) not only decimal point
# "3,75".to_d => 3.75
# "3,75".to_f => 3.75
View bishop.rb
# Bishop -- IRC bot for channel irc://
# Source:
require 'rubygems'
require 'cinch'
require 'open-uri'
require 'nokogiri'
require 'rack/utils'
View multi_db.rb
module UseMultiDB
def use_db(db_name, options={})
establish_connection "#{db_name}_#{RAILS_ENV}"
set_table_name options[:table_name] unless options[:table_name].blank?
self.inheritance_column = '_sti_type_disabled' unless options[:sti]
rescue "ERROR unable to establish connection to database '#{db_name}_#{RAILS_ENV}'"

Keybase proof

I hereby claim:

  • I am eskimag on github.
  • I am eskimag ( on keybase.
  • I have a public key whose fingerprint is D7DF 3426 8D5A 3781 3F8B 5054 7128 89AF 8B9F 420D

To claim this, I am signing this object:

EskiMag / swift_instancetype_problem
Created Dec 10, 2014
How to write 'instancetype'-like code in Swift
View swift_instancetype_problem
import Foundation
import UIKit
extension UIViewController {
class func fromMainStoryboard () -> UIViewController {
var storyboardID = NSStringFromClass(self)
let dotRangeOptional = storyboardID.rangeOfString(".", options: NSStringCompareOptions.allZeros)
if let dotRange = dotRangeOptional {
You can’t perform that action at this time.