CREATE DATABASE hello_dev;
CREATE USER devel WITH ENCRYPTED PASSWORD 'devel';
GRANT ALL PRIVILEGES ON DATABASE hello_dev TO devel;
ALTER USER devel CREATEDB;
# Also pg_hba.conf
local all devel md5
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
use sha2::{Digest, Sha256}; | |
use std::path::{Path, PathBuf}; | |
fn hash(data: String) -> [u8; 32] { | |
let mut hasher = Sha256::new(); | |
hasher.update(data.as_bytes()); | |
let r: [u8; 32] = hasher | |
.finalize() | |
.as_slice() | |
.try_into() |
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
-- See https://stackoverflow.com/questions/37376509/work-with-elm-and-select | |
-- Modified for Elm 0.19 | |
import Html exposing (..) | |
import Html.Events exposing (on) | |
import Html.Attributes exposing (..) | |
import Json.Decode as Json | |
import String | |
import Html.Events.Extra exposing (targetValueIntParse) | |
import Browser exposing (sandbox) |
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
if v, do: "v", else: "no_v" |
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
(fn true -> IO.puts("yes its true") end).(true) | |
# Example | |
"hello" |> ( fn msg -> IO.puts(msg) 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 Excep do | |
def ex() do | |
try do | |
throw("a") | |
catch | |
c -> | |
IO.inspect c # "a" | |
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 FnEx do | |
def m( %{ :a => a } , a ) do | |
IO.puts "Hello" | |
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
Process.info(self(), :current_stacktrace) |
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 MapTest do | |
def hmap(%{ :a => "a"} = changeset) do | |
IO.inspect changeset | |
end | |
end | |
MapTest.hmap(%{ :a => "a", :b => "B" }) # matches | |
MapTest.hmap(%{ :a => "A", :b => "B" }) # clause error | |
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
2> application:ensure_all_started(mongodb). | |
{ok,[bson,poolboy,pbkdf2,mongodb]} | |
3> | |
3> Database = <<"test">>. | |
<<"test">> | |
4> {ok, Connection} = mc_worker_api:connect ([{database, Database},{w_mode, safe}]). | |
{ok,<0.181.0>} | |
5> | |
5> % Drop all the docs | |
5> Collection = <<"test">>. |
NewerOlder