Skip to content

Instantly share code, notes, and snippets.

View mario1in's full-sized avatar
:dependabot:
Focusing

Mario mario1in

:dependabot:
Focusing
View GitHub Profile
@mario1in
mario1in / git-change-commit-messages.md
Created May 17, 2019 08:02 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@mario1in
mario1in / DynamicInit.swift
Created November 29, 2018 11:11 — forked from Ben-G/DynamicInit.swift
Dynamically create instance based on type in Swift
protocol Initializable {
init()
}
class A : Initializable {
var content:String
required init() {
content = "TestContent"
}
@mario1in
mario1in / AddShadowAndRoundedCorners.swift
Created November 28, 2018 03:25 — forked from cwalo/AddShadowAndRoundedCorners.swift
Override layoutSubviews to add a new layer using a path with a roundedRect and cornerRadius
private var shadowLayer: CAShapeLayer!
private var cornerRadius: CGFloat = 25.0
private var fillColor: UIColor = .blue // the color applied to the shadowLayer, rather than the view's backgroundColor
override func layoutSubviews() {
super.layoutSubviews()
if shadowLayer == nil {
shadowLayer = CAShapeLayer()
@mario1in
mario1in / gist:a6e44b8da70bc07a8a707db445df065f
Created January 10, 2018 02:53 — forked from snikch/gist:3661188
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}