Skip to content

Instantly share code, notes, and snippets.

Avatar

Melvin Rivera melvitax

View GitHub Profile
View Google Domains + GMail +Mailgun
IN MAILGUN
1. Add the Domain to Mailgun
2. In the Domain Information section, select "Manage SMTP credentials", add an email address and choose a password.
IN GOOGLE DOMAINS
1. Ensure you do not have email forwarding set up under "Configure Mail"
2. Select domain and go to "Custom resource records" under "Configure DNS"
3. Add the MX record:
- NAME:
View Swift Arrays
// Make array from properties of another array
let ids = array.map { $0.id }
// Filter duplicate items from array based on specific properties
extension Array {
func filterDuplicate<T>(_ keyValue:(Element)->T) -> [Element] {
var uniqueKeys = Set<String>()
return filter{uniqueKeys.insert("\(keyValue($0))").inserted}
View Un-track Xcode files listed in .gitignore
// Master list at: https://github.com/github/gitignore/tree/master/Global
// If you added a .gitignore file after doing your Xcode commit, git will continue tracking files even if they are listed in .gitignore.
// To fix this, move all of the files in the repository somewhere else on the filesystem (except .gitignore and .git), then run:
git add --all
git commit -m "Remove all files"
// Then add your files back in and run the following:
@melvitax
melvitax / Process Android Assets
Last active Jan 8, 2018
AppleScript for organizing Android assets. To turn into a Service: In Automator, create a new Service for files in Finder and add this script. From the Finder select a group of files that have densitiy suffixes like "icon-hdpi.png" and "icon-mdpi.png" and run the script. The files will be organized into the appropiate drawable folders and renamed.
View Process Android Assets
property sizeList : {"mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"}
property extensionList : {"jpg", "jpeg", "png"}
on run {input, parameters}
repeat with i from 1 to the count of input
set thisItem to item i of input
set itemInfo to info for thisItem
set fileName to name of itemInfo