Skip to content

Instantly share code, notes, and snippets.

Alvise Susmel alvises

Block or report user

Report or block alvises

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
alvises / app.exs
Created Nov 22, 2019
app.exs test script which connects two Elixir nodes running in two containers
View app.exs
IO.puts("I'm here! Sleeping for 2 seconds")
Process.sleep 2_000 # waiting for the other node
nodes =[:app@app1, :app@app2])
other_node =
|> MapSet.delete(Node.self())
|> MapSet.to_list()
|> List.first()
alvises / app.css
Last active Dec 11, 2019
Phoenix LiveView Gallery with Slideshow
View app.css
/* to add to assets/css/app.css */
.thumb-selected {
border: 4px solid #0069d9;
.thumb-unselected {
opacity: 0.5;
alvises / bench_hash.exs
Created Apr 9, 2019
Elixir! lines vs chunks
View bench_hash.exs
lines =!("file_path")
chunks =!("file_path",[],2_048)
hash_fun = fn enum ->
|> Enum.reduce(:crypto.hash_init(:sha),&(:crypto.hash_update(&2, &1)))
|> :crypto.hash_final()
|> Base.encode16()
alvises /
Last active Mar 30, 2019
Chunks to Lines
View example.exs
defmodule Example do
use GenServer
def start_link(_) do
GenServer.start_link __MODULE__, :ok, []
def init(:ok) do
{:ok, []}
alvises /
Created Feb 25, 2019
How to run a Docker Container
docker container run -p 8000:80 nginx
alvises / lazy_csv_bench.exs
Created Jan 13, 2019
Benchee benchmark of csv processing
View lazy_csv_bench.exs
lazy_csv_fn = fn ->!("large.csv")
|>, ","))
|> Stream.filter(fn
["Timestamp" | _] -> false
[_, "NaN" | _] -> false
[timestamp | _] ->
end) |> Enum.find(fn
alvises / client.ex
Created Dec 19, 2018
Realtime market-data updates - full channel - calculating the rate
View client.ex
defmodule Coinbase.Client do
use WebSockex
@url "wss://"
def start_link(products \\ []) do
{:ok, pid} = WebSockex.start_link(@url, __MODULE__, %{})
subscribe(pid, products)
{:ok, pid}
alvises / ghost_main.css
Last active Nov 13, 2018
Poeticoding Ghost blog style
View ghost_main.css
.site-header {
background: white !important;
background-color: white !important;
View fppopover.m
-(void)presentPopoverFromView:(UIView *)fromView
onModalViewController:(UIViewController*)modalViewController {
[self presentPopoverFromView:fromView];
//converting the origin of the popover from the old parent view to the new modal view
self.origin = [modalViewController.view convertPoint:self.origin fromView:_parentView];
//the new parent view is the modal view
[self.view removeFromSuperview];
You can’t perform that action at this time.