Skip to content

Instantly share code, notes, and snippets.

@Neophen
Neophen / Essential Full-Stack Elixir - Phoenix Boilerplate Guide.md
Created November 6, 2024 05:41
Essential Full-Stack Elixir/Phoenix Boilerplate Guide

Essential Full-Stack Elixir/Phoenix Boilerplate Guide

Core Features

1. Authentication & Authorization 🔐

Complete user authentication system including signup, signin, password management, and session handling.

Common Requirements:

  • User registration and login
  • Password reset/recovery
@Demwunz
Demwunz / liver_detox.md
Last active February 20, 2025 23:21
# Andreas Moritz Liver cleanse

Step 1: Preparation

  • Plan to do the gallbladder flush over a weekend or when you have a couple of days off work to allow for rest and relaxation.
  • During the week leading up to the flush, consume a diet consisting of mainly fresh fruits and vegetables, and avoid processed foods, animal fats, and dairy products.
  • It's recommended to perform a kidney cleanse before the gallbladder flush, as Moritz suggests that congested kidneys can hinder the effectiveness of the gallbladder flush.

Step 2: Apple Juice Intake

  • Starting from the sixth day before the flush, drink four glasses (32 ounces or 1 liter) of organic apple juice each day. Divide the juice into smaller servings and drink throughout the day.
  • The apple juice helps to soften gallstones and prepare the body for the flush.
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: []
@kipcole9
kipcole9 / function_clause.ex
Created October 23, 2019 11:04
Debug Elixir Function Clause errors
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
@budRich
budRich / i3gw
Last active August 2, 2024 10:22
ghost window wrapper for i3wm
#!/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, [])
@popravich
popravich / PostgreSQL_index_naming.rst
Last active January 6, 2025 08:57
PostgreSQL index naming convention to remember

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;
@pablinhob
pablinhob / to_marlin_gcode.py
Last active January 24, 2025 15:11
Convert standard CNC Gcode to Marlin 3D printer firmware legible format
#!/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"
@CiprianSpiridon
CiprianSpiridon / Laravel-Blade-Template-Cheatsheet
Last active January 30, 2025 09:11
Laravel Blade Template Cheatsheet
{{ $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