Complete user authentication system including signup, signin, password management, and session handling.
Common Requirements:
- User registration and login
- Password reset/recovery
defmodule MyApp.Books.Book do | |
use Ecto.Schema | |
import Ecto.Query, warn: false | |
import Ecto.Changeset | |
import MyApp.ChangesetHelpers | |
schema "books" do | |
field :name, :string | |
field :genres, {:array, :string}, default: [] |
defmodule FunctionClause do | |
@moduledoc """ | |
Format function clauses using Exception.blame/3 | |
""" | |
@doc """ | |
Given a `module`, `function`, and `args` see | |
if that function clause would match or not match. | |
This is useful for helping diagnose function |
#!/bin/bash | |
# i3gw - "ghost window" wrapper for i3 | |
# ctrl+c, ctrl+v by budRich 2017 | |
# | |
# https://www.reddit.com/r/i3wm/comments/6x5vgp/oc_i3gw/ | |
# https://gist.github.com/budRich/d09cbfd07ffdc57680fbc51ffff3687b | |
# | |
# i3-msg has an undocumented function (open) that creates | |
# empty containers, or as I call them: ghosts. |
class ListTextWidget(forms.TextInput): | |
def __init__(self, data_list, name, *args, **kwargs): | |
super(ListTextWidget, self).__init__(*args, **kwargs) | |
self._name = name | |
self._list = data_list | |
self.attrs.update({'list': 'list__{}'.format(self._name)}) | |
def render(self, name, value, attrs=None): | |
text_html = super(ListTextWidget, self).render(name, value, attrs=attrs) | |
data_list = '<datalist id="list__{}">'.format(self._name) |
defmodule MasterProxy do | |
use Application | |
# See http://elixir-lang.org/docs/stable/elixir/Application.html | |
# for more information on OTP Applications | |
def start(_type, _args) do | |
import Supervisor.Spec, warn: false | |
cowboy = Plug.Adapters.Cowboy.child_spec(:http, MasterProxy.Plug, []) |
The standard names for indexes in PostgreSQL are:
{tablename}_{columnname(s)}_{suffix}
where the suffix is one of the following:
pkey
for a Primary Key constraint;key
for a Unique constraint;excl
for an Exclusion constraint;idx
for any other kind of index;
#!/usr/bin/python | |
import re | |
import os | |
import sys | |
try: | |
sys.argv[1] | |
sys.argv[2] | |
except IndexError: | |
print "usage: ./to_marlin_gcode origin.nc origin_marlin.gcode" |
{{ $var }} - Echo content | |
{{ $var or 'default' }} - Echo content with a default value | |
{{{ $var }}} - Echo escaped content | |
{{-- Comment --}} - A Blade comment | |
@extends('layout') - Extends a template with a layout | |
@if(condition) - Starts an if block | |
@else - Starts an else block | |
@elseif(condition) - Start a elseif block | |
@endif - Ends a if block |