If you don't know anything about JSON, please, spend some time on learning JSON structure.
Recommended sources:
| /** | |
| * This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
| * a base64 string. | |
| * This code is used in my startup, Zired. | |
| * Web: http://zired.io | |
| */ | |
| // You can either "yarn add aws-sdk" or "npm i aws-sdk" | |
| const AWS = require('aws-sdk') |
| let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] | |
| extension Array { | |
| func chunks(_ chunkSize: Int) -> [[Element]] { | |
| return stride(from: 0, to: self.count, by: chunkSize).map { | |
| Array(self[$0..<Swift.min($0 + chunkSize, self.count)]) | |
| } | |
| } | |
| } |
| UIFont.familyNames.forEach({ familyName in | |
| let fontNames = UIFont.fontNames(forFamilyName: familyName) | |
| print(familyName, fontNames) | |
| }) |
| import Foundation | |
| final class Shell | |
| { | |
| func outputOf(commandName: String, arguments: [String] = []) -> String? { | |
| return bash(commandName: commandName, arguments:arguments) | |
| } | |
| // MARK: private | |
If you don't know anything about JSON, please, spend some time on learning JSON structure.
Recommended sources:
TLDR: Use for...of instead of forEach in asynchronous code.
Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)
For example, the following forEach loop might not do what it appears to do:
Find the Discord channel in which you would like to send commits and other updates
In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe!
| #!/usr/bin/env python | |
| ''' | |
| Send an multipart email with HTML and plain text alternatives. The message | |
| should be constructed as a plain-text file of the following format: | |
| From: Your Name <your@email.com> | |
| To: Recipient One <recipient@to.com> | |
| Subject: Your subject line | |
| --- |