Skip to content

Instantly share code, notes, and snippets.

View mojtabacazi's full-sized avatar

Mojtaba Cazi mojtabacazi

View GitHub Profile
@mojtabacazi
mojtabacazi / detectLanguage.m
Last active August 29, 2015 14:22
Detecting language in iOS using NSLinguisticTagger / NSSpellChecker
NSLinguisticTagger *tagger = [[NSLinguisticTagger alloc] initWithTagSchemes:@[NSLinguisticTagSchemeLanguage, nil] options:0];
[tagger setString:@"Das ist ein bisschen deutscher Text. Bitte löschen Sie diesen nicht."];
NSString *result = [tagger tagAtIndex:0 scheme:NSLinguisticTagSchemeLanguage tokenRange:NULL sentenceRange:NULL];
if ([result isEqualToString:@"und"]) {
// language detection failed
} else {
// result will be standard language abbreviations such as “en”, “fr”, “de”, etc.,
// From Apple's doc: Languages are uniformly described by BCP-47 tags , preferably in canonical form;
}
@mojtabacazi
mojtabacazi / gist:49905ae9e05a24313630
Last active August 29, 2015 14:21
Get all extensions and their respective file count in a directory
find ./ -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
TARGET="$INFOPLIST_FILE"
echo $TARGET
if [ ! -f "$TARGET" ]; then
echo "missing file $TARGET"
exit 1;
fi
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$TARGET")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$TARGET"
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start