This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.Json; | |
var jsonDocument = JsonSerializer.Deserialize<JsonElement>(""" | |
{ | |
"Germany": { "Population": 83783942, "Language": "German" }, | |
"France": { "Population": 65273511, "Language": "French" }, | |
"the Netherlands": { "Population": 17134872, "Language": "Dutch" } | |
} | |
"""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-empty-function */ | |
import { Context, Form, HttpRequest, Logger } from "@azure/functions"; | |
export const buildContext = (): Context => ({ | |
bindingData: undefined, | |
bindingDefinitions: [], | |
bindings: { }, | |
executionContext: undefined, | |
invocationId: "", | |
log: createLogger(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "compress/zip" | |
abstract class SaxParser | |
ATTR_REGEX = /([[:alnum:]]+)\=\"(.*?)\"/m | |
def initialize(xml : IO) | |
@xml = xml | |
end | |
def parse! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This multi-stage Dockerfile will use the full ruby image during build phase | |
# after this it wil build the deployment image based on the slim ruby container, | |
# copying over all artifacts from the build phase. | |
# | |
# The deployer image will not include a Javascript runtime and will come in at | |
# under 200MB for an average Rails application. | |
ARG BUILDER_FROM_IMAGE=ruby:3.0 | |
ARG DEPLOY_FROM_IMAGE=ruby:3.0-slim | |
ARG NODE_VERSION 14.15.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Iteration 1: This is basically writing Ruby in Elixir | |
params = %{"name" => "Foobar", "time" => %{"hour" => "8", "minute" => "30"}} | |
defmodule Example do | |
def cast_times_to_minutes(params, fields) do | |
Enum.map(params, fn({key, value}) -> | |
if Enum.member?(fields, key) && is_map(value) do | |
{key, time_to_minutes(value)} | |
else |