This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt> sudo touch /etc/crontab | |
Password: *************** | |
prompt> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIColor { | |
// usage: | |
// myButton.backgroundColor = UIColor.rgb(240, 10, 20) | |
class func rgb(red: Int, _ green: Int, _ blue: Int) -> UIColor { | |
return rgba(red, green, blue, 255) | |
} | |
// usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern | |
class Foo <T: Any> : T { | |
func hello() { println("hello") } | |
} | |
class Bar { | |
func world() { println("world") } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_number_of_lines(path, suffix) | |
count = 0 | |
Dir.chdir(path) do | |
cmd = 'find . -type f -name "*.SUFFIX" -print0 | xargs -0 cat | wc -l' | |
cmd.gsub!('SUFFIX', suffix) | |
result = `#{cmd}` | |
count = result.to_i | |
end | |
return count | |
end |
NewerOlder