⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
NO_COLOR='\e[0m' #disable any colors | |
BLACK='\e[0;30m' | |
RED='\e[0;31m' | |
GREEN='\e[0;32m' | |
YELLOW='\e[0;33m' | |
BLUE='\e[0;34m' | |
MAGENTA='\e[0;35m' | |
CYAN='\e[0;36m' | |
WHITE='\e[0;37m' |
Dir["#{Rails.root}/app/views/**/*.haml"].each do |file| | |
file_name = file.split("/").pop | |
file_dir = file.split("/")[0..-2] | |
value = %x(~/herbalizer #{file}) | |
new_file = File.join(file_dir, file_name.gsub("haml", "erb")) | |
File.open(new_file, 'w') do |f| | |
f.write(value) |
# Simple Phoenix authentication plug | |
# | |
# - based on Plug's session store | |
# - redirects unauthenticated requests to login page "/login/<request url>" | |
# - /static/... requests are not authenticated | |
# - authentication is valid as long as session is valid (you can change this behaviour easily) | |
# Because we need session to be fetched BEFORE this plug, we must put this to router.ex: | |
#---------------------------- |
This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible. It's not been run for very long so I don't know if it caches too much or of there is any other issues.
It should be generic enough to work on any elixir app using mix.
This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible. It's not been run for very long so I don't know if it caches too much or of there is any other issues.
It should be generic enough to work on any elixir app using mix.
This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible. It's not been run for very long so I don't know if it caches too much or of there is any other issues.
It should be generic enough to work on any elixir app using mix.
defmodule MyApp.Plugs.AuthHeaders do | |
import Plug.Conn | |
import Phoenix.Controller | |
require Logger | |
@doc """ | |
This Plug extract the `authentication` header from the connnaction | |
and extrac the tocken containing the credentials. If the header has | |
ther correct format it calls the `validate` function otherwise it | |
will return a 401 error. |
defmodule Math do | |
def sort([h | t]) do | |
sort(for x <- t, x < h, do: x) ++ [h] ++ sort(for x <- t, x >= h, do: x) | |
end | |
def sort([]), do: [] | |
end |
I hereby claim:
- I am mtanzi on github.
- I am mtanzi (https://keybase.io/mtanzi) on keybase.
- I have a public key ASDEbRpP1XELT_rOda2RNjcP_XNFOM9SojWcNVz28SIzBAo
To claim this, I am signing this object: