Skip to content

Instantly share code, notes, and snippets.

View follmann's full-sized avatar

Andreas Follmann follmann

View GitHub Profile
@coryodaniel
coryodaniel / ecto.ex
Last active October 11, 2017 14:34
Virtual / computed columns in Ecto / Elixir
schema "comments" do
field :text, :string
# ... more schema ...
field :ancestor_id, :integer, virtual: true
end
def thread(comment) do
from c in Comment,
join: cp in CommentPath, on: c.id == cp.descendant_id,
where: cp.ancestor_id == ^comment.id,
@brianjlandau
brianjlandau / gist:176754
Created August 28, 2009 02:59 — forked from defunkt/gist:162444
Rails Capistrano deploy using git as our deployment strategy. You'll need git version >=1.5.6.6 on your server for this to work.
# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "[email protected]:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current # this tells capistrano where to run the migration. otherwise it would try to use the latest release directory (/path/to/app/releases/2012XXXXXXXXX)
set :use_sudo, false
set :ssh_options, {:forward_agent => true} # so you can checkout the git repo without giving the server access to the repo
set :rails_env, 'production'
# These are here to override the defaults by cap