I hereby claim:
- I am mainshayne233 on github.
- I am mainshayne233 (https://keybase.io/mainshayne233) on keybase.
- I have a public key ASCZgTyHKGvRKnqWxBTeLLfxbBhrvtaBey7O_E-6N5E-EAo
To claim this, I am signing this object:
defmodule CursedClient do | |
import CursedLib, only: [retry: 2] | |
def make_money do | |
retry times: 10, timeout: 1_000, on_error: &IO.inspect/1 do | |
[ | |
fn -> {1_000_000, :dollars} end, | |
fn -> raise "You just got sued!" end, | |
fn -> raise "Your investors pulled out!" end, | |
fn -> raise "Your entire software team left all at once!" end, |
7 | |
14 |
defmodule MyApp.AsyncTaskRunner do | |
use Supervisor | |
defmodule Worker do | |
use GenServer | |
@ten_minutes 1000 * 60 * 10 | |
def start_link(opts) do | |
GenServer.start_link(__MODULE__, opts, name: __MODULE__) |
class Foo: | |
def a(self): | |
return "a" | |
def add(self, x, y): | |
return x + y | |
class Bar: | |
def __init__(self): |
defmodule InterceptDef do | |
@moduledoc """ | |
An examble of how you can intercept a def call at | |
compile time to do something intermediate with the | |
definition. | |
""" | |
defmacro __using__([]) do | |
quote do |
#![feature(box_syntax, box_patterns)] | |
////////////////////////////////////////////////////////////////////////////////////////////////// | |
// Lisp parser // | |
// // | |
// Write code that takes some Lisp code and returns an abstract syntax tree. The AST should // | |
// represent the structure of the code and the meaning of each token. For example, if your code // | |
// is given "(first (list 1 (+ 2 3) 9))", it could return a nested array // | |
// like ["first", ["list", 1, ["+", 2, 3], 9]]. // | |
////////////////////////////////////////////////////////////////////////////////////////////////// |
defmodule Flipper do | |
defmacro deffeature(func, do: do_block, else: else_block) do | |
{function_name, _, _} = func | |
quote do | |
def unquote(func) do | |
if Flipper.is_enabled?(unquote(function_name)) do | |
unquote(do_block) | |
else | |
unquote(else_block) | |
end |
#!/usr/bin/env bash | |
set -CEeuo pipefail | |
IFS=$'\n\t' | |
shopt -s extdebug | |
crackle_pop() { | |
local start="$1" | |
local end="$2" |
I hereby claim:
To claim this, I am signing this object:
# Normal map | |
data = [3, 6, 34, 7, 4, 23, 6] | |
expensive_function = fn x -> | |
:timer.sleep(500) | |
5 / x | |
end | |
Enum.map(data, expensive_function) |