Skip to content

Instantly share code, notes, and snippets.

View dinocosta's full-sized avatar
👷‍♂️
...

Dino dinocosta

👷‍♂️
...
View GitHub Profile
@dinocosta
dinocosta / wildberries.json
Created February 19, 2025 14:29
Wildberries Zed Theme
{
"name": "Wildberries Darker",
"appearance": "dark",
"style": {
"background.appearance": "opaque",
"accents": [],
"border": null,
"border.variant": null,
"border.focused": null,
"border.selected": null,
@dinocosta
dinocosta / twitter_card_meta_tags.html
Last active January 21, 2020 19:50
Twitter Card Meta Tags
<html>
<head>
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@joaofcosta">
<meta name="twitter:image" content="https://i.imgur.com/ilEldyU.jpg">
<meta name="twitter:title" content="Python Tuple Syntax Is Confusing">
<meta name="twitter:description" content="Post about how Python's tuple syntax can make you run around trying to fix bugs that are easily avoided.">
...
</head>
<body>
defmodule Processor do
def process(number) do
:timer.sleep(1000)
{number, :os.system_time(:millisecond)}
end
end
1..10
|> Task.async_stream(&Processor.process/1, max_concurrency: 2)
|> Enum.to_list()
defmodule Processor do
def process(number) do
:timer.sleep(10000 - (number * 1000))
number
end
end
1..10
|> Task.async_stream(&Processor.process/1, on_timeout: :kill_task)
|> Enum.to_list()
defmodule Processor do
def process(number) do
:timer.sleep(6000)
end
end
1..10
|> Task.async_stream(&Processor.process/1, timeout: 7000)
|> Enum.to_list()
defmodule Processor do
def process(number) do
:timer.sleep(6000)
end
end
1..10
|> Task.async_stream(&Processor.process/1)
|> Enum.to_list()
defmodule Increaser do
def increase(number) do
number + 1
end
end
Task.async_stream(1..10, &Increaser.increase/1)
1..10
|> Task.async_stream(fn(number) -> number + 1 end)
|> Enum.map(fn({:ok, result}) -> result end)
1..10
|> Task.async_stream(fn(number) -> number + 1 end)
|> Enum.to_list()
Task.async_stream(1..10, fn(number) -> number + 1 end)