This file contains 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
# PostgreSQL `mix ecto.create` equivalent | |
psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" | |
createdb "${DB_NAME}" | |
psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} to ${DB_USER};" | |
# PostgreSQL `mix ecto.drop` equivalent | |
dropdb "${DB_NAME}" | |
dropuser "${DB_USER}" | |
# PostgresSQL interactive terminal |
This file contains 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
# Reference: | |
# http://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf | |
# https://www.google.com/patents/US6867776 | |
# A complete implementation of a function returning a value that | |
# conforms to the new method is given below. | |
# Translated from Java class definition to Elixir module. | |
defmodule SimplexNoiseReference do | |
use Bitwise |
This file contains 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
# A speed-improved simplex noise algorithm for 2D, 3D and 4D | |
# translated from Java into Elixir. | |
# | |
# Based on example code by Stefan Gustavson ([email protected]). | |
# Optimisations by Peter Eastman ([email protected]). | |
# Better rank ordering method for 4D by Stefan Gustavson in 2012. | |
# Translated into Elixir by Brendan Sechter ([email protected]). | |
# | |
# The Java version could be speeded up even further, but it's useful | |
# as it is. Assessment of Java optimazations for the Elixir version |
This file contains 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
# Reference: | |
# http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
# Simplex noise in 2D, 3D and 4D | |
defmodule SimplexNoise do | |
@grad3 { | |
{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, | |
{1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, | |
{0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1} | |
} |
This file contains 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
# Reference: | |
# http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
# Classic Perlin noise in 3D, for comparison | |
defmodule ClassicNoise do | |
@grad3 { | |
{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, | |
{1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, | |
{0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1} | |
} |
This file contains 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
import Html | |
quote(do: markup do: text("hi")) |> Code.eval_quoted | |
markup do: text("hi") |
NewerOlder