Skip to content

Instantly share code, notes, and snippets.

@dongmai
dongmai / pubsub.swift
Created April 19, 2018 08:05 — forked from jahfer/pubsub.swift
Simple pubsub implementation in Swift
// =====================================================
enum LogLevel: Int {
case Debug = 1, Info, Error
}
let log_level = LogLevel.Debug
protocol Loggable {
func log()
# Load template data
templateData = loadThemeData()
if config.nil?
puts "Data is NIL stop here"
return
end
@dongmai
dongmai / jenkins-services.ts
Created January 5, 2022 10:05
Copy a jenkins job
let jenkins = JenkinsService.initJenkinsApi(jenkin)
jenkins.copy_job(
templateJobName,
jobName,
(config) => {
config = config.replace('<concurrentBuild>false</concurrentBuild>', `<concurrentBuild>false</concurrentBuild>\n<customWorkspace>workspace/${templateJobName}</customWorkspace>`)
config = config.replace('{GYM_EXPORT_TEAM_ID}', `${appStoreAccount.teamId}`)
config = config.replace('{KEY_ID}', `${appStoreAccount.keyId}`)
config = config.replace('{ISSUER_ID}', `${appStoreAccount.issuerId}`)
config = config.replace('{KEY_CONTENT_BASE64}', `${Util.base64Text(appStoreAccount.apiKey)}`)
@dongmai
dongmai / update-info.rb
Created January 5, 2022 10:31
Update info plist with fastlane
update_info_plist(
plist_path: "{your_plist_path}",
display_name: appName,
app_identifier: bundleId,
)
@dongmai
dongmai / change-android-app-name.rb
Created January 5, 2022 10:34
Change android app name with fastlane
android_change_string_app_name(
newName: appName,
stringsFile: filePath,
)
@dongmai
dongmai / change-appid.rb
Created January 5, 2022 10:35
Android change app id with fastlane
gradeFilePath = Dir.pwd + "/../app/build.gradle"
changeAppId(bundleId)
@dongmai
dongmai / ios-change-appicon.rb
Created January 5, 2022 10:36
iOS change app icon with fastlane
unless iconDownloadUrl.empty?
tempfile = Down.download(iconDownloadUrl)
appicon(
appicon_image_file: tempfile.path,
appicon_devices: [:iphone, :ios_marketing],
appicon_path: Dir.pwd + "#{placeHolderPath}/Placeholder.xcassets",
remove_alpha: true,
)
end
@dongmai
dongmai / android-change-appicon.rb
Created January 5, 2022 10:37
Android change app icon with fastlane
unless iconDownloadUrl.empty?
tempfile = Down.download(iconDownloadUrl)
android_appicon(
appicon_image_file: tempfile.path,
appicon_icon_types: [:launcher, :notification],
appicon_path: Dir.pwd + "#{placeHolderPath}/res/mipmap",
generate_rounded: true,
)
end
@dongmai
dongmai / replace-file.rb
Created January 5, 2022 10:38
Replace file with fastlane
unless dashIconDownloadUrl.empty?
tempfile = Down.download(dashIconDownloadUrl)
replaceFile(
"#{placeHolderPath}/Placeholder.xcassets/dash-logo.imageset/dash-logo.png",
tempfile.path
)
end