Skip to content

Instantly share code, notes, and snippets.

View assimelha's full-sized avatar
Building cool stuff

Assim EL HAMMOUTI assimelha

Building cool stuff
View GitHub Profile
@dustypomerleau
dustypomerleau / global.code-snippets
Created May 26, 2020 02:32
Library/Application\ Support/Code/User/snippets/global.code-snippets
{
"lv_module": {
"scope": "elixir, html-eex",
"prefix": "lv",
"body": [
"defmodule ${1}Web.${2}Live do",
" use ${1}Web, :live_view",
"end"
],
"description": "LiveView module"
@delameko
delameko / iso-639-1_codes.ex
Created May 11, 2017 22:14
ISO 639-1 language codes in Elixir
iso_codes = [
%{ iso_639_1: "ab", name: "Abkhazian" },
%{ iso_639_1: "aa", name: "Afar" },
%{ iso_639_1: "af", name: "Afrikaans" },
%{ iso_639_1: "ak", name: "Akan" },
%{ iso_639_1: "sq", name: "Albanian" },
%{ iso_639_1: "am", name: "Amharic" },
%{ iso_639_1: "ar", name: "Arabic" },
%{ iso_639_1: "an", name: "Aragonese" },
%{ iso_639_1: "hy", name: "Armenian" },

The Complete Guide to Nested Forms in Phoenix

I recently spent some time dealing with nested forms in Phoenix. Nested forms are great when you want to create multiple database records in a single transaction and associate them with each other. I am new to Phoenix and really struggled to find any resources that helped me with my specific problem. I decided to document what I learned in the process in hopes of helping others that are new to Elixir and Phoenix.

Here is my attempt at a one stop shop to learn everything you will need to know about nested forms. If you would like to view the GitHub repo you can check it out here.

Thanks to Heartbeat and Jose for excellent blog posts on nested forms. Also shoutout to Josh for showing me some examples at Ruby

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log('\n===========');
console.log(' mongoose version: %s', mongoose.version);
console.log('========\n\n');
var dbname = 'testing_geojsonPoint';