Skip to content

Instantly share code, notes, and snippets.

View Fadhil's full-sized avatar
💼
Building the future

Fadhil Luqman Fadhil

💼
Building the future
View GitHub Profile
@Fadhil
Fadhil / docker
Created March 10, 2021 02:40
Sets password, port forwarding, local folder sync and some kind of extra connections directive
docker run --name platform-pg-11 --restart unless-stopped -e POSTGRES_PASSWORD=password -p 127.0.0.1:5432:5432 -v ~/Magic/docker/data/platform-test:/var/lib/postgresql/data -d postgres:11 -N 500
@Fadhil
Fadhil / gist:5f205587305930b310de8549b44a9ec6
Created September 20, 2017 11:01
Basic Neo4j + Ecto stuff
# I'm doing something like this to build queries:
@spec match(%Query{}, map, string, map) :: %Query{}
def match(current_query, res_a, rel, res_b)
when is_map(res_a) and is_map(res_b) do
query_string = """
MATCH (#{get_node_var(res_a)}:#{node_name(res_a)} {#{attributes_from_struct(res_a)}})
MATCH (#{get_node_var(res_b)}:#{node_name(res_b)} {#{attributes_from_struct(res_b)}})
WITH #{get_node_var(res_a)}, #{get_node_var(res_b)}
defmodule Flexphoenix.Endpoint do
use Phoenix.Endpoint, otp_app: :flexphoenix
socket "/socket", Flexphoenix.UserSocket
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
defmodule Plug.Anonymous do
import Plug.Conn
require IEx
def init(options), do: options
def call(conn, _opts) do
anonymous_id = get_session(conn, "anonymous_id")
case anonymous_id do
defmodule Plug.Anonymous do
import Plug.Conn
require IEx
def init(options), do: options
def call(conn, _opts) do
anonymous_id = get_session(conn, "anonymous_id")
defmodule Plug.AnonymousTest do
use ExUnit.Case, async: true
use Plug.Test
require IEx
alias Plug.Anonymous
defmodule SomeApp do
defmodule SomeController do
use Plug.Builder
plug :fetch_session
defmodule Plug.AnonymousTest do
use ExUnit.Case, async: true
use Plug.Test
alias Plug.Session.COOKIE, as: CookieStore
require IEx
alias Plug.Anonymous
defmodule SomeApp do
defmodule SomeController do
defmodule SomeApp do
defmodule SomeController do
use Plug.Builder
plug Plug.Session,
store: :cookie,
key: "_wankrank_key",
signing_salt: "cmwAUEpB",
max_age: 86400
plug :fetch_session
plug Anonymous
defmodule Plug.AnonymousTest do
use ExUnit.Case, async: true
use Plug.Test
alias Plug.Session.COOKIE, as: CookieStore
require IEx
alias Plug.Anonymous
defmodule SomeApp do
defmodule SomeController do
defmodule Plug.AnonymousTest do
use ExUnit.Case, async: true
use Plug.Test
alias Plug.Session.COOKIE, as: CookieStore
require IEx
alias Plug.Anonymous
defmodule SomeApp do
defmodule SomeController do