Skip to content

Instantly share code, notes, and snippets.

View romy-aikon's full-sized avatar

romy-aikon

  • Nokia Bell Labs
  • Sunnyvale
View GitHub Profile
// nice! from this blog post https://swiftrocks.com/understanding-the-ios-responder-chain.html
extension UIResponder {
func responderChain() -> String {
guard let next = next else {
return String(describing: self)
}
return String(describing: self) + " -> " + next.responderChain()
}
}
@romy-aikon
romy-aikon / autolayoutcheatsheet.md
Last active November 15, 2018 18:53
autolayout visual language cheat sheet from Joszsef Vesza on Raywenderlich.
@romy-aikon
romy-aikon / Dangerfile
Last active August 24, 2018 22:08 — forked from candostdagdeviren/Dangerfile
Dangerfiles to like
# PR is a work in progress and shouldn't be merged yet
warn "PR is classed as Work in Progress" if github.pr_title.include? "[WIP]"
# Warn when there is a big PR
warn "Big PR, consider splitting into smaller" if git.lines_of_code > 500
# Ensure a clean commits history
if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ }
fail "Please rebase to get rid of the merge commits in this PR"
end
@romy-aikon
romy-aikon / remove-big-file.sh
Created July 25, 2018 00:20 — forked from BrunoGrandePhD/remove-big-file.sh
Remove a large committed file from your Git repository.
# The commands below are a guide to remove a large file that has been
# accidentally committed to a Git repository's history. If the file is
# larger than 100 MB, GitHub will prevent you from pushing your latest
# commits. The annotated steps below should help you remove the large
# file from your commit history, even if you've made new commit since.
# Some Git users advise against rebasing. You can safely use it here
# because you haven't published your changes yet.
# So, you first need to rebase your current branch onto the point that
@romy-aikon
romy-aikon / Networksimulator.swift
Created June 8, 2018 17:11
really great network simulator from Audrey Tam (?)
/*
* Copyright (c) 2016 Razeware LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@romy-aikon
romy-aikon / infomarkdown.md
Created April 19, 2018 21:05
available devices for xcode
@romy-aikon
romy-aikon / Hairline.swift
Created January 31, 2018 21:41 — forked from jemmons/Hairline.swift
Draws a `singlePixelLine` line above or below the given point, depending on `topBias`.
import UIKit
func singlePixelLine(at y: CGFloat, in rect: CGRect, topBias: Bool = true) {
let offset = pixelUnit/2.0
let adjustedY = round(from: y - offset, fraction: pixelUnit, down: topBias) + offset
let line = makeLine(at: adjustedY, in: rect)
strokePath(line, width: pixelUnit)
}
@romy-aikon
romy-aikon / reconfigureVisibleCells.m
Created January 25, 2018 20:06 — forked from kristopherjohnson/reconfigureVisibleCells.m
Update visible cells from a UITableViewController without calling -[UITableView reloadData]
- (void)reconfigureVisibleCells
{
NSInteger sectionCount = [self numberOfSectionsInTableView:self.tableView];
for (NSInteger section = 0; section < sectionCount; ++section) {
NSInteger rowCount = [self tableView:self.tableView numberOfRowsInSection:section];
for (NSInteger row = 0; row < rowCount; ++row) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
@romy-aikon
romy-aikon / DrawAntiRoundedCornerImage.md
Created January 9, 2018 19:59 — forked from seedante/DrawAntiRoundedCornerImage.md
Draw a mask image with Core Graphics API in Swift

MaskImage

Draw a mask image like Left-3 to blend a rounded corner:

func UIGraphicsDrawAntiRoundedCornerImageWithRadius(radius: CGFloat, outerSize: CGSize, innerSize: CGSize, fillColor: UIColor) -> UIImage{  
    UIGraphicsBeginImageContextWithOptions(outerSize, false, UIScreen.mainScreen().scale)
    let currentContext = UIGraphicsGetCurrentContext()

let bezierPath = UIBezierPath()

@romy-aikon
romy-aikon / SKImage.swift
Created January 9, 2018 00:42 — forked from jakelazaroff/SKImage.swift
A simple class that draws a PaintCode StyleKit "Image Method" image centered inside a UIView
// SKImage
// A simple class that draws a PaintCode StyleKit "Image Method" image centered inside a UIView
// - installation: add to project and replace STYLEKIT_NAME comment with name of StyleKit class
// - instantiation: SKImage(image: "NameOfImage")
// - instantiation (with custom size): SKImage(image: "NameOfImage", size: CGRectMake(0, 0, 16, 16))
import UIKit
class SKImage: UIView {