Skip to content

Instantly share code, notes, and snippets.

Ben Bahrenburg benbahrenburg

Block or report user

Report or block benbahrenburg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benbahrenburg
benbahrenburg / String+NLP.swift
Last active Feb 3, 2019
Swift String Extension to Trim Trailing Punctuation
View String+NLP.swift
extension String {
func trimTrailingPunctuation() -> String {
return self.trimmingCharacters(in: .whitespacesAndNewlines)
.trimmingCharacters(in: .punctuationCharacters)
.trimmingCharacters(in: .whitespacesAndNewlines)
}
}
@benbahrenburg
benbahrenburg / MailKitExts.cs
Last active Feb 5, 2019
MailKit ToMailAddressCollection Extension
View MailKitExts.cs
public static class MailKitExts
{
public static MailAddressCollection ToMailAddressCollection(this InternetAddressList addressList)
{
if(addressList == null)
{
return new MailAddressCollection();
}
return addressList.Mailboxes.Aggregate(new MailAddressCollection(), (c, r) => { c.Add(new MailAddress(r.Address, r.Name)); return c; });
}
@benbahrenburg
benbahrenburg / MailKitReadMessageEnvelop.cs
Last active Feb 3, 2019
MailKit InternetAddressList Example
View MailKitReadMessageEnvelop.cs
foreach (var summary in inbox.Fetch(0, -1, MessageSummaryItems.UniqueId | MessageSummaryItems.BodyStructure))
{
var tos = summary.Envelope.To;
var replyToList = summary.Envelope.ReplyTo;
}
@benbahrenburg
benbahrenburg / cocoapods-bundle-id
Created May 8, 2018 — forked from daltonclaybrook/cocoapods-bundle-id
A post install script for CocoaPods that changes the bundle identifier of all pods to the one specified.
View cocoapods-bundle-id
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == 'BREnterprise'
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution: The Carter Group LLC'
config.build_settings['PROVISIONING_PROFILE'] = '${BR_ENTERPRISE_PROVISIONING_PROFILE}'
end
end
end
@benbahrenburg
benbahrenburg / LICENSE
Created Nov 29, 2017 — forked from commonsguy/LICENSE
deaar: Convert Android AAR Artifacts Into Library Projects
View LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
@benbahrenburg
benbahrenburg / Sentimently-output.swift
Last active Jul 6, 2017
Sentiment analysis Swift
View Sentimently-output.swift
let sentiment = Sentimently()
print(sentiment.score("Cats are stupid."))
analysisResult(score: -2, comparative: -0.66666666666666663, positive: [], negative: ["stupid"], wordTokens: [wordToken(word: "cats", wordStem: Optional("cat")), wordToken(word: "are", wordStem: Optional("be")), wordToken(word: "stupid", wordStem: Optional("stupid"))])
print(sentiment.score("Cats are very stupid."))
analysisResult(score: -3, comparative: -0.75, positive: [], negative: ["stupid"], wordTokens: [wordToken(word: "cats", wordStem: Optional("cat")), wordToken(word: "are", wordStem: Optional("be")), wordToken(word: "very", wordStem: Optional("very")), wordToken(word: "stupid", wordStem: Optional("stupid"))])
print(sentiment.score("Cats are totally amazing!"))
analysisResult(score: 4, comparative: 1.0, positive: ["amazing"], negative: [], wordTokens: [wordToken(word: "cats", wordStem: Optional("cat")), wordToken(word: "are", wordStem: Optional("be")), wordToken(word: "totally", wordStem: Optional("totally")), wordToken(word: "
View lemmatize.swift
public struct wordToken {
let word: String
let wordStem: String?
init(word: String, wordStem: String?) {
self.word = word
self.wordStem = wordStem
}
}
func lemmatize(_ text: String) -> [wordToken] {
@benbahrenburg
benbahrenburg / fastlane-setBuildNumberOnExtension.rb
Created Mar 12, 2017
Fastlane method for updating extension CFBundleVersion
View fastlane-setBuildNumberOnExtension.rb
def setBuildNumberOnExtension(build_number)
raise if build_number.nil?
puts "Setting Extension to build number #{build_number}"
sh("/usr/libexec/PlistBuddy -c 'Set CFBundleVersion #{build_number}' ../myWatchApp/Info.plist")
sh("/usr/libexec/PlistBuddy -c 'Set CFBundleVersion #{build_number}' ../myWatchAppExtension/Info.plist")
end
@benbahrenburg
benbahrenburg / fastlane-build.rb
Created Mar 12, 2017
Fastlane build using setBuildNumberOnExtension
View fastlane-build.rb
desc "Create ipa"
lane :build do
increment_build_number
setBuildNumberOnExtension(
get_build_number
)
gym(scheme: "TestApp", workspace: "TestApp.xcworkspace", output_directory: "../../../Builds/TestApp", clean:true, silent: true, export_method: "enterprise")
end
You can’t perform that action at this time.