Skip to content

Commit

Permalink
Added breadcrumbs to blog posts (#1225)
Browse files Browse the repository at this point in the history
* Added breadcrumbs to blog posts

* Fixed to_parquet example
  • Loading branch information
norberttech committed Sep 15, 2024
1 parent e70c723 commit b3d9811
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 3 deletions.
21 changes: 21 additions & 0 deletions examples/topics/data_sink/parquet/code.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use function Flow\ETL\Adapter\Parquet\to_parquet;
use function Flow\ETL\DSL\{data_frame, from_array, overwrite};

require __DIR__ . '/../../../autoload.php';

data_frame()
->read(from_array([
['id' => 1],
['id' => 2],
['id' => 3],
['id' => 4],
['id' => 5],
]))
->collect()
->saveMode(overwrite())
->write(to_parquet(__DIR__ . '/output.parquet'))
->run();
11 changes: 11 additions & 0 deletions examples/topics/data_sink/parquet/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Write data to a parquet file.

```php
function to_parquet(string|Path $path) : Loader
```

Additional options:

* `withOptions(\Flow\Parquet\Options $options)` - [Options](https://github.com/flow-php/flow/blob/1.x/src/lib/parquet/src/Flow/Parquet/Options.php) for the parquet writer
* `withCompression(Compressions $compression)` - default `Compressions::SNAPPY`, supports one of the following [Compressions](https://github.com/flow-php/flow/blob/1.x/src/lib/parquet/src/Flow/Parquet/ParquetFile/Compressions.php)
* `withSchema(Schema $schema)` - when provided writer will use this instead of inferring schema from each rows batch
Binary file added examples/topics/data_sink/parquet/output.parquet
Binary file not shown.
1 change: 1 addition & 0 deletions examples/topics/data_sink/parquet/priority.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions examples/topics/data_sink/priority.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
2 changes: 1 addition & 1 deletion examples/topics/data_source/parquet/description.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Read data from a json file.
Read data from a parquet file.

```php
function from_parquet(string|Path $uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function from_parquet(
* @return Loader
*/
#[DocumentationDSL(module: Module::PARQUET, type: DSLType::LOADER)]
#[DocumentationExample(topic: 'data_sink', example: 'parquet')]
function to_parquet(
string|Path $path,
?Options $options = null,
Expand Down
2 changes: 1 addition & 1 deletion web/landing/assets/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ code {
}

#blog-post {
@apply pt-10 pb-5 px-2 sm:px-4 mx-auto max-w-screen-xl;
@apply pb-5 px-2 sm:px-4 mx-auto max-w-screen-xl;
}

#blog-post hr, p, pre, ul, h2, h3 {
Expand Down
2 changes: 1 addition & 1 deletion web/landing/resources/dsl.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions web/landing/templates/blog/post.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@
{%- endblock -%}

{% block main %}
<section class="mt-5 mb-5 sm:px-4 mx-auto max-w-screen-xl">
<ul class="inline">
<li class="inline mr-2">
<a href="{{ path('blog') }}" class="text-blue-500 hover:underline">Blog</a>
</li>
<li class="inline mr-2">
<span class="text-gray-500">/</span>
</li>
<li class="inline mr-2">
<span>{{ post.title }}</span>
</li>
</ul>
</section>
{{ block('article') }}
<section class="mb-10 px-2 sm:px-4 mx-auto max-w-screen-xl">
<script src="https://giscus.app/client.js"
Expand Down
18 changes: 18 additions & 0 deletions web/landing/templates/example/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@
{% endapply %}
</div>
{% endif %}

<div class="mt-5">
<script src="https://giscus.app/client.js"
data-repo="flow-php/flow-php.com"
data-repo-id="R_kgDOHja2Yg"
data-category="Examples"
data-category-id="DIC_kwDOHja2Ys4CieC7"
data-mapping="url"
data-strict="0"
data-reactions-enabled="0"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="dark"
data-lang="en"
crossorigin="anonymous"
async>
</script>
</div>
</div>
</div>
{% endblock %}

0 comments on commit b3d9811

Please sign in to comment.