A port of a cheat sheet authored by Hafiz Ismail.
defmodule MyApp.Schema do
use Absinthe.Schema
A port of a cheat sheet authored by Hafiz Ismail.
defmodule MyApp.Schema do
use Absinthe.Schema
Links: | |
A Visual Introduction to Machine Learning | |
http://www.r2d3.us/visual-intro-to-machine-learning-part-1/ | |
UC Berkeley CS188 Intro to AI -- Course Materials | |
http://ai.berkeley.edu/home.html | |
Eyeo 2016 – Gene Kogan | |
https://vimeo.com/180044029 |
defmodule MyApp.Scheduler do | |
@moduledoc """ | |
Schedules a Mix task to be run at a given interval in milliseconds. | |
## Options | |
- `:task`: The name of the Mix task to run. | |
- `:args`: A list of arguments to pass to the Mix task's `run/1` function. | |
- `:interval`: The time interval in millisconds to rerun the task. |
$ rails c | |
Running via Spring preloader in process 7916 | |
/Users/edmac/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError) | |
Referenced from: /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle | |
Reason: image not found - /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle | |
Fixed with: | |
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib |
lock '3.5.0' | |
set :application, 'your-app' | |
set :repo_url, 'https://github.com/your/app' | |
set :deploy_to, '/home/deploy/apps/your-app/' | |
namespace :deploy do | |
after :updated, :build do | |
on roles(:web) do | |
execute "cd '#{release_path}' && shards install" |
import "phoenix_html" | |
import "bootstrap" | |
import "jquery" | |
import "toastr" | |
// ... |
Just about the only thing that'll crash the Erlang VM is running out of memory. Although processes themselves are cheap, a good way to run out of memory is to start an unbounded number of processes from an external signal (such as one per web request), and then make each of those processes hold onto some more expensive resource. If you're not careful about cleanup, you can also leak processes, which compounds the problem. Anyway, nobody's perfect, so to avoid these cases, we use the poolboy library in a bunch of places to handle process pools that handle cleanup and limit the total amount of concurrency to some reasonable amount.
When:
you'll see "checkout" timeouts (waited longer than the timeout to check out a worker from the pool):
iex> i 'hello'
Term
defmodule EctoBatchStream do | |
import Ecto.Query, only: [from: 1, from: 2] | |
@batch_size 1000 | |
# Example: | |
# | |
# query = from u in MyApp.User, select: u.email | |
# stream = EctoBatchStream.stream(MyApp.Repo, query) | |
# stream |> Stream.take(3) |> Enum.to_list # => […] |
# Phoenix Framework - A productive web framework that does not compromise speed and maintainability | |
[Unit] | |
Description=Phoenix Framework ISControl Application | |
After=network.target | |
[Service] | |
Type=simple | |
User=deployer | |
RemainAfterExit=yes |