Skip to content

Instantly share code, notes, and snippets.

View baldwindavid's full-sized avatar

David Baldwin baldwindavid

  • Indianapolis, IN
View GitHub Profile
@baldwindavid
baldwindavid / build_stubbed_strategy.ex
Created April 2, 2021 17:37
Build Stubbed Strategy for ExMachina
defmodule MyApp.Factories.BuildStubbedStrategy do
use ExMachina.Strategy, function_name: :build_stubbed
alias Ecto.Association.BelongsTo
alias Ecto.Association.Has
alias Ecto.Association.NotLoaded
alias Ecto.UUID
def handle_build_stubbed(record, _opts \\ []) do
record
@baldwindavid
baldwindavid / crud.ex
Last active April 8, 2021 16:40
Macros to perform context crud operations
defmodule MyApp.Crud do
defmacro list(config) do
quote bind_quoted: [config: config] do
def unquote(:"list_#{config.plural_name}")(queries \\ & &1) do
unquote(config.schema)
|> queries.()
|> unquote(config.repo).all()
end
end
end
{
"assistant": {
"default_model": {
"provider": "copilot_chat",
"model": "gpt-3.5-turbo"
},
"version": "2"
},
"auto_update": true,
"theme": {
[
////////////////////////////////////////////
// All Contexts
////////////////////////////////////////////
{
"bindings": {
// Open Project
"cmd-shift-p": "projects::OpenRecent",
// Left Dock
// Static tasks configuration.
[
{
"label": "Sublime Merge",
"command": "smerge .",
"reveal": "never",
"hide": "always"
},
{
"label": "Lazygit",