Skip to content

Instantly share code, notes, and snippets.

View GE-N's full-sized avatar

Jerapong Nampetch GE-N

View GitHub Profile
@GE-N
GE-N / CalendarExtension.swift
Created October 31, 2018 08:40
Calendar method; Get first monday and first day of year helper
import Foundation
extension Calendar {
static func australia() -> Calendar {
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = TimeZone(abbreviation: "UTC")!
calendar.locale = Locale(identifier: "en_AU")
return calendar
}
class PollCell: UITableViewCell {
var header: HeaderView!
var pollContent: PollMultipleChoicesView!
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
backgroundColor = UIColor.lightGray
header = HeaderView()
contentView.addSubview(header)
header.snp.makeConstraints { (make) in
class Table: UITableViewController {
override func viewDidLoad() {
tableView.estimatedRowHeight = 100
tableView.rowHeight = UITableViewAutomaticDimension
tableView.translatesAutoresizingMaskIntoConstraints = false
}
override func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return 1
import UIKit
import XCPlayground
import PlaygroundSupport
import SnapKit
import MobileCoreServices
extension String {
func isImageExtension(_ ext: String) -> Bool {
let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, ext, nil)
guard let imageUTI = uti?.takeRetainedValue() else { return false }
return UTTypeConformsTo(imageUTI, kUTTypeImage)
}
func isImageLink() -> Bool {
import MobileCoreServices
extension String {
func isImageExtension(_ ext: String) -> Bool {
let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, ext, nil)
guard let imageUTI = uti?.takeRetainedValue() else { return false }
return UTTypeConformsTo(imageUTI, kUTTypeImage)
}
func isImageLink() -> Bool {
source 'https://bitbucket.org/jerapongn/jnspec'
use_frameworks!
target 'Newsfeed_Example' do
pod 'Newsfeed', :path => '../'
target 'Newsfeed_Tests' do
inherit! :search_paths
# pod 'FBSnapshotTestCase'
@GE-N
GE-N / newsfeedpodspec
Created November 9, 2016 09:55
newsfeedpodspec
Pod::Spec.new do |s|
s.name = 'Newsfeed'
s.version = '0.1.0'
s.summary = 'A short description of Newsfeed.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/GE-N/Newsfeed'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
@GE-N
GE-N / PodfileMyapp
Created November 4, 2016 09:47
podfile after
platform :ios, '10.0'
use_frameworks!
def core_pods
pod 'MyApp_API', :git => 'https://bitbucket.org/gomeeki_mobile_team/myapp-api'
end
...
target 'MyApp' do
@GE-N
GE-N / gist:e143cf971a77e519d3f240b059013130
Last active November 4, 2016 09:26
myappapi podspec
Pod::Spec.new do |s|
s.name = 'MyApp_API'
s.version = '0.1.0'
s.summary = 'A short description of MyApp_API.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/<GITHUB_USERNAME>/MyApp_API'