Skip to content

Instantly share code, notes, and snippets.

@allanalves
allanalves / separate_the_numbers.swift
Last active August 12, 2022 15:51
Hackerrank 'Separate the Numbers' Solution
func separateNumbers(s: String) -> Void {
guard s.count > 1 else {
print("NO")
return
}
let s = Array(s)
guard s.count > 2 else {
let leftNum = s.first?.wholeNumberValue ?? 0
let rightNum = s.last?.wholeNumberValue ?? 0
@allanalves
allanalves / projects.json
Last active August 24, 2018 19:22
Mock JSON for Projects Entity
[
{
"id": "Rd02Xfwdo",
"name": "Weekly Deliverables",
"description": "SAP",
"approver": "Jack Nelson"
},
{
"id": "Yd05sfDdP",
"name": "Monthly Deliverables",
<activity android:name="SettingsActivity" ... >
<intent-filter>
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
if [ "$CONFIGURATION" == "Release" ]; then
rm -Rf $BUILD_APP_DIR/Settings.bundle
fi
let preferred = Service.preferredEnvironment()
let url = Service.enviromentUrl(preferred)
enum Environment: String {
case production
case homologation
case development
case custom
}
static func preferredEnvironment() -> Environment {
if let env = UserDefaults.standard.string(forKey: "environment") {
return Environment(rawValue: env)!