This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = "hello" | |
salt = "foo" | |
token = Phoenix.Token.sign(PotsWeb.Endpoint, salt, data) | |
IO.inspect(token, limit: :infinity, label: "token") | |
# How to manipulate token to get back "hello" from it without using | |
# Phoenix.Token functions | |
decode_token = fn token -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# :jsv is automatically pulled with :oaskit but since we are going to use it, | |
# let's be explicit about the deps! | |
Mix.install( | |
[ | |
{:oaskit, "~> 0.3"}, | |
{:jsv, "~> 0.10"}, | |
{:plug_cowboy, "~> 2.5"}, | |
{:jason, "~> 1.0"}, | |
{:phoenix, "~> 1.8.0-rc.3"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tool do | |
def tokenize(str) do | |
tokenize(str, [], [], :whitespace) | |
end | |
@special_chars ~c"\"'.,;:!?()[]{} \n\t\r/\\*_@$“”" | |
def tokenize(<<c::utf8, rest::binary>>, token_acc, acc, :whitespace) | |
when c in @special_chars do | |
tokenize(rest, [c | token_acc], acc, :whitespace) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Aoe.Y21.Day16 do | |
alias Aoe.Input, warn: false | |
@type input_path :: binary | |
@type file :: input_path | %Aoe.Input.FakeFile{} | |
@type part :: :part_one | :part_two | |
@type input :: binary | File.Stream.t() | |
@type problem :: any | |
require Record |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env elixir | |
Mix.install([:jason]) | |
defmodule Heater do | |
import Kernel, except: [spawn_link: 1] | |
def spawn_link() do | |
Kernel.spawn_link(fn -> init() end) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Heater do | |
import Kernel, except: [spawn_link: 1] | |
def spawn_link() do | |
Kernel.spawn_link(fn -> init() end) | |
end | |
defp init() do | |
send(self(), :heat) | |
loop_idle() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Constants.Compiler do | |
@moduledoc false | |
defmacro __using__(_) do | |
quote do | |
Module.register_attribute(__MODULE__, :const_def, accumulate: true) | |
import unquote(__MODULE__), only: [const: 2] | |
@before_compile unquote(__MODULE__) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Disease-it: | |
url: "http://disease-it.jeuweb.org/" | |
image: "https://img.itch.zone/aW1nLzMxMTA5ODQucG5n/original/zO55Li.png" | |
description: | |
email: [email protected] | |
id_thread: 12568 | |
"L'ile du coeur": | |
url: http://www.ile-du-coeur.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Day4 do | |
def run(range_str) do | |
[from, to] = | |
range_str | |
|> String.split("-") | |
|> Enum.map(&String.to_integer/1) | |
Range.new(from, to) | |
|> Stream.map(&to_charlist/1) | |
|> Stream.filter(&has_increasing_digits/1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
TYPE curs IS REF CURSOR; | |
c curs; | |
q varchar2(200); | |
idx VARCHAR(200); | |
tab VARCHAR(200); | |
col VARCHAR(200); | |
BEGIN | |
q := 'select index_name,table_name,column_name from user_sdo_index_info'; | |
OPEN c FOR q; |
NewerOlder