Skip to content

Instantly share code, notes, and snippets.

@AdamT
AdamT / Vue-cli-3-Phoenix-1.3-HOWTO.md
Created November 28, 2019 04:37 — forked from jpbecotte/Vue-cli-3-Phoenix-1.3-HOWTO.md
Vue-cli 3, Phoenix 1.3, a complete how-to

Introduction

I have been struggling to start a new project with Phoenix 1.3 and the new vue-cli 3 for Vue.js. There are tons of example already but none of them suited my needs, because:

  • I want to use the new Vue-cli to select the features that I want,
  • I do NOT want to setup Webpack (I know, what a shame!). The new Vue-cli includes the new vue-cli-service, which uses an instance of webpack-dev-server, so you don't have to import it manually in your project.
  • I do not want to use Brunch.

Create your Phoenix App

Assuming that you have Elixir and Phoenix 1.3 are both installed, let's build our new App.

@AdamT
AdamT / gist:ca4aad381e626e9fa53d2de65299eae8
Last active June 17, 2018 13:21
Can't require rails_helper from my own ModelFactory
/Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require': cannot load such file -- rails_helper (LoadError)
from /Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
from /Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
from /Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
from /Users/me/development/apps/project/spec/factories/troublemaker_factory_spec.rb:1:in `<top (required)>' <--------- oops
from /Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `load'
from /Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:277:in `block in load'
from /Users/me/.rvm/gems/ruby-2.4.1@project/gems/activesupport-5.2.0/lib/active_support/dependencies.
@AdamT
AdamT / circle.yml
Created June 11, 2018 23:47 — forked from vtno/circle.yml
My CircleCI 1.0 configuration to enable Chrome headless.
dependencies:
pre:
# install chrome
- wget -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P ~/
- sudo dpkg -i --force-depends ~/google-chrome-stable_current_amd64.deb
- sudo apt-get -f install -y
- sudo dpkg -i --force-depends ~/google-chrome-stable_current_amd64.deb
- sudo rm /usr/local/bin/chromedriver
# install chromedriver
- wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
@AdamT
AdamT / circle_ci_elm_tests_fix.md
Created October 10, 2017 19:05
Circle CI Elm Tests Fix

Problem

When running elm-test on Circle CI, your builds will run indefinitely due to an issue with determining CPU usage. The following might help be of help to you.

Solution

Configure Circle CI (i.e. circle.yml) as follows:

machine:

Up and running with ElasticSearch in Rails

  1. rails new blog

  2. cd blog

  3. rails g model Article title text:text

  4. rails db:migrate

  5. Run ElasticSearch:

docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:5.2.2
@AdamT
AdamT / assets.rake
Created February 14, 2017 06:21 — forked from listenrightmeow/assets.rake
Rails 3 asset pipeline deploy task with s3 and cloudfront support
namespace :assets do
desc 'Precompile assets and upload to S3'
task :sync => :environment do
assets = build_asset_dir
raise 'asset directory is empty: aborting' unless assets.size > 1
invalid_files = build_assets assets
delete_old_assets assets
invalidate_files invalid_files unless invalid_files.empty?
module MyApp
class Application < Rails::Application
if Rails.env == 'test'
require 'diagnostic'
config.middleware.use(MyApp::DiagnosticMiddleware)
end
end
end