Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
module Aedict where
import Data.Maybe (maybe)
import Text.Regex.PCRE.Heavy
defmodule Foo do
def crash_unless_password(pw) do
"password" = pw
IO.puts "I didn't crash!"
end
def validate_v1(token) do
case token do
"tok_" <> _ ->
IO.puts "Valid token `#{token}!`"
# INSTALL -- ERLANG & ELIXIR
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install erlang erlang-dev elixir
# INSTALL -- HEX, PHOENIX, & NODE 6.X
mix local.hex
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
module Main exposing (..)
type Msg
= AddVoteResponse (Result Error Model)
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of

The Polite お Prefix

Why is it お名前は何ですか (why the お at the front)?

Good question!

The short answer is that placing an at the beginning of some nouns will make them more polite, particularly when they relate to or "belong to" the listener, such as the お名前 ("your name") above.

Similar Examples

$ echo '#!/usr/bin/env ruby\n\nputs "hello, /usr/bin"'> foo
$ chmod +x foo
$ ./foo
hello, /usr/bin
$ foo
zsh: command not found: foo
$ cp foo /usr/bin
module SyntaxExample exposing (..)
import Http
type Msg
= HttpResponse (Result Http.Error String)

Struct. I want a class to hold variables, that the gist?

conceptually, very close. but having a "class" implies that we have objects and methods, and none of those exist in Elixir/Erlang.

instead, there's just data (e.g. strings, numbers, lists, maps, structs) and behavior (functions), and structs are data.

structs are also just "maps" (read: hashes) under the hood, but they have a :__struct__ key that points to the module they belong to.

i think the big question is: what do we use structs for?

function getValueForInputWithName ( inputs, name ) {
var value = null
for ( var i = 0; i < inputs.length; i++ ) {
if ( inputs[i].name == name )
value = inputs[i].value
}
return value
}
<form>
<input type="hidden" name="redirect" value="/your/redirect/path/here"
</form>
<script>
document.addEventListener('wpcf7submit', function( event ) {
var path = "/thank-you"
var inputs = event.detail.inputs