Skip to content

Instantly share code, notes, and snippets.

Plamen Andreev plam4u

Block or report user

Report or block plam4u

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
@plam4u
plam4u / DebugWithKeyboard.m
Last active Jan 10, 2017
Debugging via keyboard shortcuts.return array of UIKeyCommand objects, which define a keyboard shortcut.The ViewController will execute corresponding actions mapped to the shortcut.Useful when you want to simulate interactivity but the UI is not ready yet or when you just need to do some debug work.
View DebugWithKeyboard.m
- (BOOL)canBecomeFirstResponder
{
return YES;
}
-(NSArray *)keyCommands
{
return @[
[UIKeyCommand keyCommandWithInput:@"1" modifierFlags:0 action:@selector(debugCommand1)],
[UIKeyCommand keyCommandWithInput:@"2" modifierFlags:0 action:@selector(debugCommand2)]
@plam4u
plam4u / generate_storyboard_constants.rb
Created Apr 21, 2018 — forked from ralfebert/generate_storyboard_constants.rb
Generate Swift constants for Xcode storyboards containing cell reuse identifiers, segue identifiers and storyboard identifier. More information: https://www.ralfebert.de/storyboard-constants/
View generate_storyboard_constants.rb
#!/usr/bin/env ruby
require 'nokogiri'
def show_usage(msg = nil)
puts "#{msg}\n\n" if msg
puts "Usage:\n\t#{$PROGRAM_NAME} [storyboard_file]"
exit(0)
end
View MediumBlogFontHandling_FullCode.swift
import Foundation
import UIKit
// Usage Examples
let system12 = Font(.system, size: .standard(.h5)).instance
let robotoThin20 = Font(.installed(.RobotoThin), size: .standard(.h1)).instance
let robotoBlack14 = Font(.installed(.RobotoBlack), size: .standard(.h4)).instance
let helveticaLight13 = Font(.custom("Helvetica-Light"), size: .custom(13.0)).instance
struct Font {
View TableHeaderView - variable height
extension UITableView {
/// Variable-height UITableView tableHeaderView with autolayout
///
/// Source: https://gist.github.com/marcoarment/1105553afba6b4900c10
func layoutTableHeaderView() {
guard let headerView = self.tableHeaderView else { return }
headerView.translatesAutoresizingMaskIntoConstraints = false
You can’t perform that action at this time.