Skip to content

Instantly share code, notes, and snippets.

View mlvea's full-sized avatar
🎯
Focusing

Phanerozoic mlvea

🎯
Focusing
  • Singapore
  • 13:16 (UTC +08:00)
View GitHub Profile

Privacy Policy for Swift Prism

Last updated: July 11, 2026
App name: Swift Prism (also shown as “Prism”)

This Privacy Policy describes how Swift Prism (“the App”) handles information when you use the software on your Mac. By using the App, you agree to this policy.


Summary

@mlvea
mlvea / print_user_accounts.sh
Created August 22, 2018 02:08
AWK Examples[Field Separator, Skip comments, Beginning Text]: Read /etc/passwd and format.
awk '/^#/ {next} BEGIN {FS=":"; print "\Name\tUserID\tGroup\tHomeDirectory"} { print $1"\t"$3"\t"$4"\t"$6}' /etc/passwd
eu 1.230,23 ¤ 1.230,23 ¤¤¤
hr 1.230,23 KM 1.230,23 konvertibilne marke
en FCFA1,230 1,230 Central African CFA francs
en FBu1,230 1,230 Burundian francs
rw RF 1.230 1.230 RWF
ast 1.230,23 ¤ 1.230,23 ¤¤¤
en E1,230.23 1,230.23 Swazi emalangeni
he ‏1,230.23 ₪ 1,230.23 שקלים חדשים
ar ١٬٢٣٠٫٢٣ ¤ ١٬٢٣٠٫٢٣ ¤¤¤
uz ¤ ۱٬۲۳۰٫۲۳ ۱٬۲۳۰٫۲۳ ¤¤¤
@mlvea
mlvea / String+Abbreviation.swift
Created January 13, 2017 11:51
Abbreviation from CamelCase String
extension String {
func abbrevatedByCapitalLetters() -> String {
var abbrevations = [Character]()
for character in self.characters where String(character) == String(character).uppercased() {
abbrevations.append(character)
}
return String(abbrevations)
}
}
func mergeSort<T: Comparable>(inout array:[T],p: Int, r: Int) -> [T]{
var p = p
guard r > p else{
return array
}
var q = p + (r-p)/2
@mlvea
mlvea / NSManagedObject+Duplicate.h
Created June 2, 2016 08:51
Easily duplicate CoreData objects with this universal category
//
// NSManagedObject+Duplicate.h
//
// Copyright (c) 2014 Barry Allard
//
// MIT license
//
// inspiration: https://stackoverflow.com/questions/2998613/how-do-i-copy-or-move-an-nsmanagedobject-from-one-context-to-another
#import <CoreData/CoreData.h>
@mlvea
mlvea / allemail.txt
Created October 4, 2015 10:59
Almost All emails regex. Got this at http://stackoverflow.com/a/719543
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
@mlvea
mlvea / UIView+AutoLayout.swift
Created September 28, 2015 13:45
UIView extension to bind subview bounds to its superview
extension UIView{
func boundInside(superView: UIView){
self.translatesAutoresizingMaskIntoConstraints = false
superView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[subview]-0-|", options: NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics:nil, views:["subview":self]))
superView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[subview]-0-|", options: NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics:nil, views:["subview":self]))
}
@mlvea
mlvea / build_number_overlay.sh
Created September 22, 2015 14:14
bash scripts to build number overlay on iOS app icons
IFS=$'\n'
function tagAllIcons(){
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
APP_ICONS_PATH="${PROJECT_DIR}/BuildNumberTagger/Images.xcassets/AppIcon.appiconset"
REFERENCE_ICONS_PATH="${PROJECT_DIR}/BuildNumberTagger/AppIconReference.xcassets"
for ICON_PATH in $(find ${REFERENCE_ICONS_PATH} -name "*Icon*.png")
@mlvea
mlvea / valid_invalid_enum_and_why.swift
Last active August 29, 2015 14:27
Swift Valid and Invalid enums with reasons
//Define a class Cat
class Cat {
}
enum EnumWithRaw : Cat{
/*
INVALID
[Error]: Raw Type Cat is not convertible from any literal
[Reason]: Raw value of enum have to be of type strings, characters, or any of the integer or floating-point number types.