This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_record/connection_adapters/abstract_mysql_adapter" | |
# NOTE: Set SRID 0 as same as mysql's default | |
silence_warnings do | |
GeoRuby::SimpleFeatures::DEFAULT_SRID = 0 | |
end | |
module ActiveRecord | |
module Type | |
class Spatial < Value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add below into config/application.rb: | |
# | |
# config.middleware.use 'RequestLogger' | |
# | |
class RequestLogger | |
def initialize app | |
@app = app | |
end | |
def call(env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class FloatingView: UIView { | |
var keyboardSize: CGFloat = 0 | |
open var height: CGFloat = 56 { | |
didSet { | |
self.setNeedsDisplay() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Google | |
module Cloud | |
module Bigquery | |
class Dataset | |
def create_time_partitioned_table table_id, name: nil, description: nil, type: 'DAY', expiration_ms: nil | |
ensure_service! | |
new_tb = Google::Apis::BigqueryV2::Table.new( | |
table_reference: Google::Apis::BigqueryV2::TableReference.new( | |
project_id: project_id, dataset_id: dataset_id, | |
table_id: table_id), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'geo_ruby/ewk' | |
# NOTE: Set SRID 0 as same as mysql's default | |
GeoRuby::SimpleFeatures::DEFAULT_SRID = 0 | |
module ActiveRecord | |
module Type | |
class Spatial < Value | |
def type | |
:spatial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
extension UITableView { | |
// NOTE: Workaround for the broblem of iOS8 when using UITableViewAutomatic Dimension. http://stackoverflow.com/questions/25589540/uitableview-refresh-without-scrolling | |
func reloadDataWithKeepingContentOffset() { | |
let prevContentOffset = contentOffset | |
reloadData() | |
layoutIfNeeded() | |
contentOffset = prevContentOffset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class func setupRealm() { | |
let config = Realm.Configuration( | |
deleteRealmIfMigrationNeeded: true | |
) | |
Realm.Configuration.defaultConfiguration = config | |
// Test | |
do { | |
try Realm() | |
} catch let error as NSError { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
// mavenCentral() | |
mavenLocal() | |
} | |
dependencies { | |
classpath 'com.twitter:twitter-text:1.9.0' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'nokogiri' | |
doc = Nokogiri::HTML(open('http://www.iana.org/domains/root/db')) | |
tlds = [] | |
doc.css('table#tld-table tr').each do |tr| | |
info = tr.css('td') | |
next if info.empty? | |
tlds << { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath group: 'org.twitter4j', name: 'twitter4j-core', version: '3.0.5' | |
} | |
} | |
import twitter4j.* |