Skip to content

Instantly share code, notes, and snippets.

@5ran6
5ran6 / digitalOcen-functions.md
Last active October 24, 2023 06:01
[SERVERLESS] How to use Digital Oceans app functions

OFFICIAL DOCUMENTATION can be found here

KEY TAKEAWAYS

RUNTIME

TIMEOUT

As of September 29, 2022: DigitalOcean Functions now support a maximum timeout of 15 minutes. The 15-minute maximum timeout provides ample execution time for the functions we will build in this auto-provider service. However, it's best practice to optimize the code to use the shortest reasonable runtime. This avoids accruing unnecessary costs for extended execution.

Additionally, be mindful of cold starts when architecting the functions. Cold starts occur when a function first spins up and initializes before it can handle requests. For Go functions on DigitalOcean, the average cold start latency is around 500ms (Go, Node.js, Python, and Ruby functions have been benchmarked in the 400-600ms range for cold starts).

@5ran6
5ran6 / morse.rb
Created November 12, 2022 23:31 — forked from trejo08/morse.rb
Morse Code translator written in Ruby as solution of CodementorX Assessment.
class Morse
def posibilities(signals)
signals.include?('?') ? check_wildcard(signals) : morses["#{signals}"]
end
def check_wildcard(signals)
length = signals.split('').length
values = []
if length.eql?(1)
values = ["E", "T"]