(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
Dir["../image_migrations/establishments/*"].each do |establishment_id_dir| | |
Dir["#{establishment_id_dir}/*"].each do |products_dir| | |
Dir["#{products_dir}/*"].each do |product| | |
extension = File.extname(product).downcase | |
name = File.basename(product, extension) | |
formatted_name = ActiveSupport::Inflector.transliterate(name).parameterize.downcase.underscore | |
path = File.dirname(product) | |
new_path = "#{path}/#{formatted_name}#{extension}" | |
# puts new_path |
This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.
For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai
This is the current flow and some details about the implemented features: | |
1. When the user visits the app, the service worker caches the "index.html" file and the "static assets", | |
after that, every page that the user visits it, the service worker caches, | |
so for example, if we go to "reports" page, after visiting will cache that page, | |
if we go to "surveys" page after visiting will cache and so on. | |
If the user disconnect the internet connection (or turn "offline" mode in the browser's dev tools, on network section) and | |
refresh the page, the app should still load and the user can navigate between the "cached pages". | |
2. We are caching the following resources: |
# Estrutura da pagina | |
1. header | |
1.2. navbar | |
1.2.1. navbar list | |
1.2.1.1. navbar list item | |
2. main | |
2.1. content | |
2.2. aside |
$ cd ~/Library/Application\ Support/Postgres/var-10
$ \rm -f postmaster.pid
OR
$ \rm -f ~/Library/Application\ Support/Postgres/var-10/postmaster.pid
import Service from '@ember/service'; | |
import Bowser from 'bowser'; | |
export default Service.extend({ | |
getBrowserName() { | |
if (window?.navigator?.userAgent) { | |
const browser = Bowser.getParser(window.navigator.userAgent); | |
if (browser?.parsedResult?.browser?.name) { | |
const browserName = browser.parsedResult.browser.name; | |
switch(browserName) { |