More Testing ephp
To continue testing ephp with the new features I release, first we need a fresh ephp version:
git clone https://github.com/altenwald/ephp
cd ephp
make
file client_purchases { | |
filename "client_purchases.csv", | |
delimiter "," | |
} | |
struct csv_format { | |
client_name string required, | |
client_age integer, | |
product_name string required, | |
product_price decimal required |
-module(crc16). | |
-export([calculate/1]). | |
calculate(Data) -> | |
calculate(Data, 0). | |
calculate([H | T], CRC) when H >= 0 andalso H =< 255 -> | |
calculate(T, (CRC bsl 8) bxor crc16tab(((CRC bsr 8) bxor H) band 16#00FF)); | |
calculate([], CRC) -> |
defmodule Chat do | |
@moduledoc """ | |
Handle a process with a name for performing chat with other processes of the same kind. | |
It is an example about how a chat could be, based on the interchange of information | |
between the processes in a direct way, or using a list of processes. | |
""" | |
use GenServer | |
@type name() :: atom() |
@doc """ | |
A transformation for items. Analyze the content configuring a new value in the metadata | |
called `reading_time`. | |
""" | |
transform "reading_time" do | |
set on: :item | |
set run: fn(post, _config) -> | |
words_count = | |
post["content"] |
@doc """ | |
A set of transformations to help us work with categories. | |
This extension requires the following configuration entries: | |
[categories.desarrollo] | |
class = "cat-1" | |
link = "category/desarrollo" | |
[categories.historias] | |
class = "cat-2" |
@doc """ | |
Check local links, if there is a broken link the compilation fails. | |
You can configure the kind of URLs to avoid to check. For example, if you | |
want to avoid check dependencies like PDF or images: | |
[links] | |
exclude_uris = [ | |
'^/pdf/', | |
'^/images/' |
#!/bin/bash | |
set -eo pipefail | |
container=$1 | |
image=$(docker inspect --format '{{.Config.Image}}' $container) | |
cmd=$(docker inspect --format '{{.Config.Cmd}}' $container) | |
if [[ $cmd == '<nil>' ]]; then cmd=''; fi | |
binds=$(docker inspect --format '{{.HostConfig.Binds}}' $container | sed "s/\[//; s/\]//") | |
if [[ $binds == '<nil>' ]]; then binds=''; fi | |
envs=$(docker inspect --format '{{.Config.Env}}' $container | sed "s/\[//; s/\]//") |
[core] | |
# delta requires installation (delta & bat) | |
pager = delta | |
[delta] | |
plus-color = "#012800" | |
minus-color = "#340001" | |
# syntax-theme = gruvbox-light | |
syntax-theme = gruvbox | |
[interactive] |
defmodule AdjacentCells do | |
@moduledoc """ | |
This module is a way to search, mark and count the adjacent cells based on | |
the post published by Kevin Ghadyani originally in JavaScript and showing | |
that using Elixir the code could be simpler and powerful. | |
https://medium.com/free-code-camp/bet-you-cant-solve-this-google-interview-question-4a6e5a4dc8ee | |
Indeed, the original code run by Kevin is spending in the better case 229 ms | |
with 3 random colors and more than 1 second with only one color. |
To continue testing ephp with the new features I release, first we need a fresh ephp version:
git clone https://github.com/altenwald/ephp
cd ephp
make