Skip to content

Instantly share code, notes, and snippets.

View rungxanh1995's full-sized avatar
🇨🇦

Joe Pham rungxanh1995

🇨🇦
View GitHub Profile
@krzysztofzablocki
krzysztofzablocki / gist:338eddf527a351de825bd62cf2a1de28
Last active June 13, 2024 12:19
Use Sourcery to Generate bash script that will rewrite your source code to add final to all classes that have no inheritance
#!/usr/bin/env bash
<% for type in types.classes { -%>
<%_ if type.modifiers.map{ $0.name }.contains("final") || type.modifiers.map{ $0.name }.contains("open") || types.based[type.name].isEmpty == false { continue } -%>
<%_ _%>git grep -lz 'class <%= type.name %>' | xargs -0 perl -i'' -pE "s/class <%= type.name %>(?=\s|:)/final class <%= type.name %>/g"
<% } %>
// Run with Sourcery on your codebase and then execute generated code via bash :)
@e23z
e23z / animatedReload.swift
Created July 26, 2017 15:58
[Animated UITableView Reload] How to animate an UITableView when it reloads its data. #ios #swift #animation #ui
UIView.transitionWithView(tableView,
duration: 0.35,
options: .TransitionCrossDissolve,
animations: { () -> Void in
self.tableView.reloadData()
},
completion: nil);
/*
possible animations: