Skip to content

Instantly share code, notes, and snippets.

@Koze
Koze / speechVoices.tsv
Last active July 8, 2024 02:24
List of AVSpeechSynthesisVoice.speechVoices() on iOS Device
Language Name Quality Identifier Class
ar-SA Maged Default com.apple.ttsbundle.Maged-compact AVSpeechSynthesisVoice
cs-CZ Zuzana Default com.apple.ttsbundle.Zuzana-compact AVSpeechSynthesisVoice
da-DK Sara Default com.apple.ttsbundle.Sara-compact AVSpeechSynthesisVoice
de-DE Anna Default com.apple.ttsbundle.Anna-compact AVSpeechSynthesisVoice
de-DE Helena Default com.apple.ttsbundle.siri_female_de-DE_compact AVSpeechSynthesisVoice
de-DE Martin Default com.apple.ttsbundle.siri_male_de-DE_compact AVSpeechSynthesisVoice
el-GR Melina Default com.apple.ttsbundle.Melina-compact AVSpeechSynthesisVoice
en-AU Catherine Default com.apple.ttsbundle.siri_female_en-AU_compact AVSpeechSynthesisVoice
en-AU Gordon Default com.apple.ttsbundle.siri_male_en-AU_compact AVSpeechSynthesisVoice
@jonelf
jonelf / luhnTest
Last active July 2, 2019 10:23
Luhn test in Swift.
func lunhCheck(number : String) -> Bool
{
let reversed = reverse(number).map { String($0).toInt()! }
return reduce(enumerate(reversed), 0, {(sum, val) in
let odd = val.index % 2 == 1
return sum + (odd ? (val.element == 9 ? 9 : (val.element * 2) % 9) : val.element)
}) % 10 == 0
}
lunhCheck("49927398716")
@airspeedswift
airspeedswift / LuhnAlgorithm.swift
Last active August 29, 2015 14:09
Luhn Algorithm for Credit Card Validation using lazy() in Swift
// See @SwiftLDN's tweet for a short description of the Luhn algorithm:
// https://twitter.com/SwiftLDN/status/529412592834338817
// or Wikipedia for a longer one.
// http://en.wikipedia.org/wiki/Luhn_algorithm
//
// Only meant to show extending Swift's lazy() for infotainment purposes,
// not necessarily recommending best or even good practices!
//
// Alternative, saner, solutions here:
@gonecoding
gonecoding / Readme.markdown
Created February 22, 2011 12:42
Adding methods to NSData and NSString using categories to provide AES256 encryption on iOS

Important notice

I took down this Gist due to concerns about the security of the encryption/decryption part of this code (see comments below).

Rob Napier (@rnapier) has created a publicly available class that provides similar AES encryption/decryption functionality at https://github.com/rnapier/RNCryptor.