tag:blog.johnwmatthews.com,2013:/posts John W. Matthews Blog 2019-07-31T17:29:59Z tag:blog.johnwmatthews.com,2013:Post/1101306 2016-10-23T14:07:15Z 2016-10-23T14:32:40Z Setting up Golang Development Env with Atom Editor

Below blog post does a good job of introducing several Atom addons for golang development

https://rominirani.com/setup-go-development-environment-with-atom-editor-a87a12366fcf#.tux17tlu9

Introduced addons are:

  • go-plus
  • autocomplete-go
  • terminal-plus


Replacing 'terminal-plus' for 'platformio-ide-terminal'

I ran into problems of terminal-plus not responding so replaced it with platformio-ide-terminal

apm install platformio-ide-terminal






]]>
tag:blog.johnwmatthews.com,2013:Post/1096280 2016-10-05T20:44:59Z 2016-10-05T20:44:59Z Webpack watch not working in vagrant/docker...issue with inotify support...need to use polling approach

http://andrewhfarmer.com/webpack-watch-in-vagrant-docker/

]]>
tag:blog.johnwmatthews.com,2013:Post/1093071 2016-09-24T18:35:32Z 2016-09-24T18:35:32Z vagrant plugin install landrush fails: An error occurred while installing eventmachine (1.0.9.1), and Bundler cannot continue.

Ran into a problem installing 'landrush' with vagrant

OSX 10.11.6

Error with installing a dependency eventmachine (1.0.9.1)

Sample Error:

$ vagrant plugin install landrush
Installing the 'landrush' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

An error occurred while installing eventmachine (1.0.9.1), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.9.1'` succeeds before bundling.

...
..skipping...
/opt/vagrant/embedded/bin/ruby -r ./siteconf20160924-85278-6sy73w.rb extconf.rb
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... no
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... no
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... no
checking for main() in -lcrypto... yes
checking for main() in -lssl... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
-----
Found OpenSSL in path /usr/local/opt/openssl
-----
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... no
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... no
/opt/vagrant/embedded/include/ruby-2.2.0/ruby/intern.h:454:42: note: passing argument to parameter here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
                                         ^
em.cpp:941:9: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
        return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
               ^~~~~~~~
               rb_thread_fd_select
./em.h:29:22: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
/opt/vagrant/embedded/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
em.cpp:1065:6: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
                                        EmSelect (0, NULL, NULL, NULL, &tv);
                                        ^~~~~~~~
                                        rb_thread_fd_select
./em.h:29:22: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
/opt/vagrant/embedded/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
    ^
4 errors generated.
make: *** [em.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jmatthews/.vagrant.d/gems/gems/eventmachine-1.0.9.1 for inspection.
Results logged to /Users/jmatthews/.vagrant.d/gems/extensions/universal-darwin-12/2.2.0/eventmachine-1.0.9.1/gem_make.out


Found a workaround here

https://github.com/eventmachine/eventmachine/issues/553#issuecomment-218450602

$ brew install openssl
Warning: openssl-1.0.2g already installed

$ brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.2g... 1588 symlinks created

$ vagrant plugin install landrush
Installing the 'landrush' plugin. This can take a few minutes...
Installed the plugin 'landrush (1.1.2)'!
]]>
tag:blog.johnwmatthews.com,2013:Post/1088621 2016-09-10T12:47:50Z 2016-09-10T12:47:50Z Clear 301, Redirect Cache from Google Chrome

How to clear the redirect cache in google chrome

Background:
 
I ran into a problem during development of setting an incorrect 301 cache from nginx.
Issue I had was redirecting http to the wrong https server.
Google Chrome cache the 301 redirect and continued to serve the wrong redirect even after I fixed the remote site.

Googling showed me how to temporarily disable the redirect cache by bringing up the 'settings' of the developer tools and selecting to disable cache when tools were open.  That removed the cache...while the tools were open...once I closed the tools the bad cache entry was still present.

Then I found I could clear the cache by:
  1. Visit:  chrome://net-internals/
  2. Click the upper right arrow and select 'Clear cache'

The invalid entry is now resolved :)


]]>
tag:blog.johnwmatthews.com,2013:Post/1088433 2016-09-09T18:59:08Z 2016-09-09T19:10:26Z Use 'npm install --no-bin-links' to workaround npm issue (ENOENT for various bin files) in vagrant VM with directory on shared filesystem.

Ran into an issue with 'npm install' in a Vagrant VM on VirtualBox.

Issue might be related to running 'npm install' from a shared filesystem.

Error is:

npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v5.11.0
npm ERR! npm  v3.8.6
npm ERR! path /vagrant/webui/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/webui/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid'
npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/webui/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

Attempting workaround with: 'npm install --no-bin-links'

Related github issues:

]]>
tag:blog.johnwmatthews.com,2013:Post/1087515 2016-09-07T14:33:19Z 2019-07-31T17:29:59Z ENOENT: no such file or directory, scandir '..../node_modules/node-sass/vendor'
$ time ember build
ENOENT: no such file or directory, scandir '/vagrant/webui/node_modules/node-sass/vendor'
Error: ENOENT: no such file or directory, scandir '/vagrant/webui/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:856:18)
    at Object.getInstalledBinaries (/vagrant/webui/node_modules/node-sass/lib/extensions.js:119:13)
    at foundBinariesList (/vagrant/webui/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/vagrant/webui/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/vagrant/webui/node_modules/node-sass/lib/errors.js:45:5)
    at Object. (/vagrant/webui/node_modules/node-sass/lib/index.js:15:28)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

$ ls node_modules/node-sass/
bin  binding.gyp  CHANGELOG.md  lib  LICENSE  node_modules  package.json  README.md  scripts  src  test

Issue was fixed by running

npm rebuild node-sass

https://github.com/sass/node-sass/issues/1387#issuecomment-185451183

$ npm rebuild node-sass

> node-sass@3.9.3 install /vagrant/webui/node_modules/node-sass
> node scripts/install.js

Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.9.3/linux-x64-47_binding.node
Binary downloaded and installed at /vagrant/webui/node_modules/node-sass/vendor/linux-x64-47/binding.nodede:

> node-sass@3.9.3 postinstall /vagrant/webui/node_modules/node-sass
> node scripts/build.js

"/vagrant/webui/node_modules/node-sass/vendor/linux-x64-47/binding.node" exists.
 testing binary.
Binary is fine; exiting.
node-sass@3.9.3 /vagrant/webui/node_modules/node-sass
]]>
tag:blog.johnwmatthews.com,2013:Post/1077490 2016-07-30T16:52:58Z 2016-07-30T16:52:58Z Ember.js: Self-referencial (Reflexive) relationship not displaying.
Ran into a problem of ember not display a self referencing relationship.

Below is a snippet of the model for a 'user'
import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string'),
  name: DS.attr('string'),
  agent: DS.belongsTo('user')
});
The relationship for 'agent' was not displaying in templates, yet occasionally I'd see one of the models render the relationship.
Ember docs now cover this as Reflexive
Fix was to change my model to have an explicit inverse
import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string'),
  name: DS.attr('string'),
  agent: DS.belongsTo('user', { inverse: null })
});
]]>
tag:blog.johnwmatthews.com,2013:Post/1076416 2016-07-26T23:22:49Z 2016-07-26T23:22:49Z Git Tips

Articles:

]]>
tag:blog.johnwmatthews.com,2013:Post/1061388 2016-06-09T00:53:43Z 2016-06-09T00:53:43Z Ember {{action}} isn't firing on <div> elements in iOS Safari/Chrome

Ran into an issue where an ember.js app was mostly working on Safari/Chrome on iOS, but one of the actions was not firing on a div element.  I couldn't find any errors in the javascript console (after connecting iPad to Mac and using the Safari Developer menu).

Finally figured out issue was the action was never firing...traced that down to learn there are issues with touch events on certain html elements.


An easy work around is to add:

 style="cursor: pointer"

Example:
{{#each sortedFoos as |foo|}}
  
    <div style="cursor: pointer" class="col-md-4 {{if (eq foo.id foo.bar.id) 'highlighted'}}" {{action 'selected' foo }}>
    </div>
{{/each}}
This post from StackOverflow helped:
http://stackoverflow.com/questions/31256340/emberjs-div-does-not-fire-click-event-action
]]>
tag:blog.johnwmatthews.com,2013:Post/1059958 2016-06-05T14:39:24Z 2016-06-05T14:39:24Z Ember: Uncaught TypeError: Cannot read property 'shouldSupercede' of undefined

Ran into a problem of "Uncaught TypeError: Cannot read property 'shouldSupercede' of undefined"


Turns out the issue was that my route had a dynamic segment and I forgot to pass in the parameter.

Further, this was a mistake on my part, that I was creating a 'new' route, didn't want the 'new' route to be dynamic.

 I was calling something like {{#link-to "foo.bar.new"}} where foo.bar required a bar to passed to the route.


this.route('foo', function() {
    this.route('bar', {
      path: ':bar_id'
    }, function() {
      this.route('baz');
      this.route('new');
    });
});

Resolved the issue by changing the route from 'foo.bar.new' to 'foo.new' which would create the bar entry

this.route('foo', function() {
    this.route('new'),
    this.route('bar', {
      path: ':bar_id'
    }, function() {
      this.route('baz');
    });
});
]]>
tag:blog.johnwmatthews.com,2013:Post/1058502 2016-06-01T15:39:47Z 2016-06-01T15:40:30Z Example: Launch tmux session to run a command as a desired user
"su -l -c 'tmux new -d -s sesion_name \"cd /somewhere && command_to_execute\"' desired_username"

Borrowed from an example I saw from David Gao
]]>
tag:blog.johnwmatthews.com,2013:Post/1016792 2016-03-20T12:51:22Z 2016-03-20T12:51:22Z Rails Generator Examples

Cheatsheet for common rails generator examples

  • Create a new model:
    • rails g model Invoice name:string order:integer
  • Create a join table between 2 existing models:
    • rails generate migration CreateJoinTableCustomerInvoice customer invoice


]]>
tag:blog.johnwmatthews.com,2013:Post/1016447 2016-03-19T16:51:32Z 2016-03-19T16:53:27Z Using {{link-to}} with Bootstrap requires some extra work for expected Bootstrap Navigation Styling. (ember-cli-active-link-wrapper Addon solves issue)

Using {{link-to}} with Bootstrap requires some extra work.

Bootstrap expects 
 <li> <a> </a> <li>

Additionally bootstrap expects a class="active" attribute on the <li>
Ember.js will mark the class="active" on the <a> when you use {{link-to}}

This will break the boostrap styling.

You can use the below ember add-on to make this easier, essentially it introduce a new component {{active-link}}
You use {{active-link}} instead of <li>

https://github.com/alexspeller/ember-cli-active-link-wrapper


<ul class="nav nav-tabs" role="tablist">
{{#active-link}}
  {{#link-to "foo" }}Foo{{/link-to}}
{{/active-link}}
{{#active-link}}
  {{#link-to "bar" }}Bar{{/link-to}}
{{/active-link}}
</ul>

]]>
tag:blog.johnwmatthews.com,2013:Post/1012419 2016-03-12T17:07:29Z 2016-03-12T17:58:09Z Building RHEL Box for Vagrant

Libvirt:

Virtual Box

  • Example of building a RHEL 7 box for VirtualBox and Vagrant
    • Referenced Blog Post:
    • Assumunptions:
      • we are building this on OSX
      • we have already downloaded an ISO for RHEL 7.2
    • Versions tested with:
      • VirtualBox 5.0.16
      • Packer 0.9.0
    • Steps:
      • brew install packer
      • git clone https://github.com/chef/bento.git
      • cd bento
      • mkdir -p iso/rhel
      • Modify rhel-7.2-x86_64.json
        • Update 'iso_name' so it points to the correct ISO
      • Copy your downloaded ISO to ./iso/rhel
      • $ time packer build -only=virtualbox-iso -var 'mirror=file:///git/vagrant/bento/iso' rhel-7.2-x86_64.json
        • update the mirror variable to point to the correct directory, for me I'm running out of /git/vagrant/bento
        • took ~10 minutes to finish on my Macbook Pro
      • vagrant box add rhel72_test builds/rhel-7.2.virtualbox.box


Converting an existing qcow2 image to VirtualBox format:

  • qemu-img convert -O vdi vda.img vda.vdi
    • Note:  For Vagrant usage, we wouldn't want to just convert an existing libvirt image to virtualbox format, we will want to also install virtualbox guest additions to shared folders will function in vagrant<->virtualbox
]]>
tag:blog.johnwmatthews.com,2013:Post/971120 2016-03-06T17:00:39Z 2016-03-06T17:00:39Z Sed example: update a value in a block of a config file

Sed example for updating a value in a block in a config file

Thanks to Jason Montleon for the example

[jmontleo@jmontleo ~]$ cat alpha.txt 
[lazy]
#enabled: false

[foo]
#enabled: false
[jmontleo@jmontleo ~]$ sed -i '/^\[lazy\]$/{$!{N;s/^\[lazy\]\n#enabled: false$/[lazy]\n#enabled: true/;ty;P;D;:y}}' alpha.txt
[jmontleo@jmontleo ~]$ cat alpha.txt 
[lazy]
#enabled: true

[foo]
#enabled: false


Reference: http://unix.stackexchange.com/questions/26284/how-can-i-use-sed-to-replace-a-multi-line-string

]]>
tag:blog.johnwmatthews.com,2013:Post/997476 2016-02-20T00:42:13Z 2016-02-20T00:47:47Z Building 'pg' gem on OSX when using Postgres.app

Error seen during "gem install pg"

Installing pg 0.18.3 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/jmatthews/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20160219-13102-1ygzen8.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/jmatthews/.rvm/rubies/ruby-2.2.2/bin/$(RUBY_BASE_NAME)
	--with-pg
	--without-pg
	--enable-windows-cross
	--disable-windows-cross
	--with-pg-config
	--without-pg-config
	--with-pg_config
	--without-pg_config
	--with-pg-dir
	--without-pg-dir
	--with-pg-include
	--without-pg-include=${pg-dir}/include
	--with-pg-lib
	--without-pg-lib=${pg-dir}/lib

extconf failed, exit code 1

Gem files will remain installed in /Users/jmatthews/.rvm/gems/ruby-2.2.2/gems/pg-0.18.3 for inspection.
Results logged to /Users/jmatthews/.rvm/gems/ruby-2.2.2/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.3/gem_make.out

Solution

$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config'
This could take a while...
Successfully installed pg-0.18.4
Parsing documentation for pg-0.18.4
Installing ri documentation for pg-0.18.4
Done installing documentation for pg after 3 seconds
1 gem installed

With Bundler

bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
bundle install
]]>
tag:blog.johnwmatthews.com,2013:Post/992732 2016-02-13T22:51:46Z 2016-02-13T22:51:46Z FrontEnd Development Links ]]> tag:blog.johnwmatthews.com,2013:Post/992494 2016-02-13T15:15:03Z 2016-02-13T15:38:25Z ember-cli examples

ember g model my-model name:string

ember generate route my-route-name

ember generate controller name-of-my-route

ember g http-mock room_attributes

ember g route admin/room_attributes/room_attribute --path=':id'

ember g route admin/room_attributes/index

ember g controller "admin/items/item"

ember g controller "admin/room-elements/room-element"


ember g route admin/styles

ember g route admin/styles/style --path=':style_id'


ember g http-mock style

ember g model style




]]>
tag:blog.johnwmatthews.com,2013:Post/988066 2016-02-07T18:33:52Z 2016-02-13T14:42:15Z Ruby + Ember.js: ActiveModelSerializers

Notes on configuring Ruby on Rails to use ActiveModelSerializers with Ember.js


Ruby Notes:

Configure ActiveModelSerializers to use 'embed = :ids, embed_in_root = true'


Ember will expect the response to be in a format like this:
{
  "famous_person": {
    "id": 1,
    "first_name": "Barack",
    "last_name": "Obama",
    "occupation": "President"
  }
}

Controller needs to reflect that the JSON parameters will be included in a hash of the object's name
Example:
        desc 'Create a widget.'
        params do
          requires :widget, type: Hash do
            requires :name, type: String, desc: 'Widget name'
          end
        end
        post do
          widget_params = params["widget"]
          Widget.create!({
            name: widget_params[:name],
          })
        end


Logging:


To enable logging of API requests add the gem  'grape-middleware-logger' to your Gemfile
    gem 'grape', '>= 0.14.0'
    gem 'grape-middleware-logger'




Ember Notes:

  1. ember install active-model-adapter
  2. Follow the instructions at -> https://github.com/ember-data/active-model-adapter#usage

 



]]>
tag:blog.johnwmatthews.com,2013:Post/987354 2016-02-06T17:40:38Z 2016-02-06T20:57:08Z Ruby Testing

RSpec


Examples

]]>
tag:blog.johnwmatthews.com,2013:Post/967624 2016-01-09T21:12:05Z 2016-01-09T21:25:41Z Bootstrap Tutorials/Tips ]]> tag:blog.johnwmatthews.com,2013:Post/965209 2016-01-06T20:21:12Z 2016-01-06T20:21:12Z SSH Tunneling
A SSH Tunnel allows you to send traffic to a remote machine through another machine.   I often use this to access instances on another network which my desktop can not see.  

Example:

Let's open a tunnel on our port 9009 which will reach port 443 on a remote machine
  • ssh -L 9009:localhost:443 root@192.168.252.10
    • This will open port 9009 on our local host and direct traffic on 9009 to port 443 on the remote machine 192.168.252.10

Generally I need to go further and use a remote machine as a gateway to reach another machine, so I'll open up a tunnel on the remote machine as well:

  • ssh -t -t -L 9009:localhost:9009 root@foo.example.com 'ssh -L 9009:localhost:443 root@192.168.252.10'
    • With this port 9009 on localhost will redirect to 9009 on foo.example.com which will redirect to 443 on 192.168.252.10
]]>
tag:blog.johnwmatthews.com,2013:Post/961425 2016-01-01T15:12:35Z 2016-01-16T15:54:19Z Editor Customizations
  • Atom
    • https://atom.io/
    • Enabling vim-mode
      • apm install vim-mode
      • apm install ex-mode
      • then restart Atom
    • Enable Preview Tabs
      • Packages -> Settings View -> Manage Packages 
        • Search 'tabs'
          • Click 'settings'
            • Enable 'Use Preview Tabs'
]]>
tag:blog.johnwmatthews.com,2013:Post/953280 2015-12-19T16:33:59Z 2016-06-26T13:03:23Z WebUI Frontend Components

Useful frontend components:

  • Perfect Scrollbar
    • http://noraesae.github.io/perfect-scrollbar/
    • ember-cli addon:  https://www.npmjs.com/package/ember-perfectscroll


Layout Tools:

  • http://bootstrapstudio.io/


Bootstrap Example Links:


Example Progress Step Bars:

Example flipping a box on click

Misc:

  • Online book:  Front-end Handbook
    • https://www.gitbook.com/book/frontendmasters/front-end-handbook/details

]]>
tag:blog.johnwmatthews.com,2013:Post/953275 2015-12-19T16:07:22Z 2016-08-10T20:22:24Z Ember.js Articles/Tutorials/Links

Collection of articles on ember.js that have helped me learn:

  • Ember Addons
    • http://www.emberaddons.com/
  • Explanation of 'Data Down Actions Up' pattern
    • https://emberway.io/ember-js-goodbye-mvc-part-1-21777ecfd708#.n3y620b1a
  • Ember.js Components
    • http://www.programwitherik.com/ember-js-components-examples/
  • Typeahead Component
    • https://github.com/aupac/ember-aupac-typeahead
  • Promise/RSVP articles
    • http://www.barelyknown.com/blog/2014/12/14/understanding-ember-data-and-rsvp-promise-chaining
  • Questions/Problems
    • Sub-components and actions not bubbling up automatically
      • http://discuss.emberjs.com/t/sub-component-action-not-bubbling-up/6739/7
    • Closure Actions
      • http://emberjs.com/blog/2015/06/12/ember-1-13-0-released.html#toc_closure-actions
        • How to call an action on a route using closure actions
          • http://stackoverflow.com/questions/31101296/how-to-call-an-action-on-a-route-using-closure-actions
    • What should a REST API return for ember-data
      • Helped me fix a problem with PUT/POST where I was returning plural in http-mocks, should have been singular.
      • http://discuss.emberjs.com/t/what-should-an-api-compatible-rest-server-return/779
    • Binding element attributes in a template
      • https://guides.emberjs.com/v2.2.0/templates/binding-element-attributes/
    • Examining a select box with Ember 2.0
      • http://balinterdi.com/2015/08/29/how-to-do-a-select-dropdown-in-ember-20.html
        • https://gist.github.com/rtablada/280778b093768172cf43
    • Bootstrap active links with <li active=true>{{link-to}}</li>
    • Scroll to top of page on each ember route
  • Components
  • General Ember Blogs
  • Conference Talks
    • EmberConf 2015 Opening Keynote
      • https://www.youtube.com/watch?v=o12-90Dm-Qs&feature=youtu.be&t=47m21s

  • Helpers:
    • Ember Truth Helpers (provides 'eq' helper)
      • https://github.com/jmurphyau/ember-truth-helpers

Notes:
  • What is Ember.K
    • http://ember.zone/what-the-hell-is-ember-k/ 
      • Making methods safe to call in the event that they might be undefined at the time of calling.
      • Providing hooks for subclasses to implement in a safe way.
      • Creating stand in action event handlers until you are ready to implement the necessary logic, and avoid Ember.js throwing an error.
  • Creating a closure action on a nested component
    • On the template
      • {{my-component saveAction=(action 'saveControllerAction')}}
        • Assumes 'saveControllerAction' is an action defined on the controller.
          • saveControllerAction() calls this.send('saveRouteAction', this.get('model'))
          • It's important the action name is different between controller and router, if they are same you run into a circular reference and will stack overflow.
]]>
tag:blog.johnwmatthews.com,2013:Post/937773 2015-12-19T15:58:32Z 2015-12-19T15:58:33Z Creating a superuser in PostgreSQL
create role pguser with superuser login password 'test';
]]>
tag:blog.johnwmatthews.com,2013:Post/937766 2015-12-19T15:58:27Z 2016-02-06T23:48:20Z Example creating a new rails api app Notes from working with: https://devmynd.com/blog/2014-7-rails-ember-js-with-the-ember-cli-redux-part-1-the-api-and-cms-with-ruby-on-rails/
  1. Create new rails app
    
    rails new backend -T -d postgresql
    cd backend
    
  2. Edit Gemfile and be sure the below is included
    
    gem "grape"
    gem "grape-active_model_serializers"
    gem "grape-swagger-rails"
    
    group :development do
      gem "better_errors"
      gem "meta_request"
      gem "quiet_assets"
      gem "spring"
      gem "rails-erd"    # Generates a Entity Relationship Diagram
    end
    
    group :development, :test do
      gem "capybara"
      gem "capybara-screenshot"
      gem "database_cleaner"
      gem "factory_girl_rails"
      gem "faker"
      gem "poltergeist"
      gem "pry-nav"
      gem "pry-rails"
      gem "pry-stack_explorer"
      gem "pry-theme"
      gem "rspec-rails"
      gem "rubocop"
      gem "shoulda-matchers"
      gem "spring-commands-rspec"
      gem "annotate"  # Annotates model classes with comments of db fields
    end
    
    
     
  3. Install the dependencies
    
    bundle install
    
  4. Edit credentials for database, config/database.yml
  5. 
    default: &default                                                        
      adapter: postgresql                                                                  
      ....
      .... 
      host:  localhost                                                                       
      username: pguser                                                                    
      password: test
    
  6. Run some generators
    
    bundle exec rails generate rspec:install
    bundle exec spring binstub --all
    bundle exec rake db:create db:migrate db:seed
    
  7. 
    bundle exec rails generate model contact first_name:string last_name:string email:string title:string
    

Example from original blog post:


References:

]]>
tag:blog.johnwmatthews.com,2013:Post/937655 2015-11-22T15:34:21Z 2015-11-22T15:34:21Z Creating a new ember-cli app with bootstrap

Creating a new ember-cli app with Bootstrap


Steps:

  1. Install ember-cli
    
    sudo dnf install nodejs npm
    npm install -g bower
    npm install -g phantomjs
    npm install -g ember-cli
    
  2. Create new ember application
    
    ember new $NAME
    cd $NAME
    npm install
    bower install
    
  3. Install 'bootstrap'
    
    bower install --save-dev bootstrap
    
  4. Add bootstrap dependency to Brocfile.js
    
    app.import('bower_components/bootstrap/dist/css/bootstrap.min.css');
    app.import('bower_components/bootstrap/dist/js/bootstrap.min.js');
    
]]>