Skip to content

Instantly share code, notes, and snippets.

View happysalada's full-sized avatar
🤍

Yt happysalada

🤍
View GitHub Profile
/*
It's now a package. You can find it here:
https://github.com/joshnuss/svelte-local-storage-store
*/
// Svelte store backed by window.localStorage
// Persists store's data locally
# http://adventofcode.com/2017/day/3
defmodule Day3 do
require Integer
def part1(square) do
final_point =
memory_points()
|> Stream.drop_while(&(&1.square != square))
|> Enum.take(1)
@karmajunkie
karmajunkie / epmdless.ex
Last active April 5, 2018 23:39
Implementation of an epmd replacement
# A module containing the function that determines the port number
# based on a node name.
# Taken from https://www.erlang-solutions.com/blog/erlang-and-elixir-distribution-without-epmd.html
defmodule Epmdless do
def dist_port(name) when is_atom(name) do
dist_port Atom.to_string name
end
def dist_port(name) when is_list(name) do
dist_port List.to_string name
@globin
globin / configuration.nix
Last active March 1, 2024 00:46
prometheus on nixos
{ pkgs, lib, config, ... }:
{
networking = {
firewall.allowedTCPPorts = [
3000 # grafana
9090 # prometheus
9093 # alertmanager
];
useDHCP = true;
};
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active June 25, 2024 07:29
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@ahmadshah
ahmadshah / randomizer.ex
Created September 1, 2016 10:28
Random string in elixir
defmodule Randomizer do
@moduledoc """
Random string generator module.
"""
@doc """
Generate random string based on the given legth. It is also possible to generate certain type of randomise string using the options below:
* :all - generate alphanumeric random string
* :alpha - generate nom-numeric random string
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing