https://rominirani.com/setup-go-development-environment-with-atom-editor-a87a12366fcf#.tux17tlu9
Introduced addons are:
I ran into problems of terminal-plus not responding so replaced it with platformio-ide-terminal
apm install platformio-ide-terminal
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)'!]]>
The invalid entry is now resolved :)
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:
]]>$ 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]]>
import DS from 'ember-data'; export default DS.Model.extend({ email: DS.attr('string'), name: DS.attr('string'), agent: DS.belongsTo('user') });
import DS from 'ember-data'; export default DS.Model.extend({ email: DS.attr('string'), name: DS.attr('string'), agent: DS.belongsTo('user', { inverse: null }) });]]>
Articles:
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: ]]>
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'); }); });]]>
"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]]>
Cheatsheet for common rails generator examples
Using {{link-to}} with Bootstrap requires some extra work.
<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>]]>
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
]]>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
$ 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
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config bundle install]]>
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
"famous_person": { "id": 1, "first_name": "Barack", "last_name": "Obama", "occupation": "President" } }
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
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:
Useful frontend components:
Layout Tools:
Bootstrap Example Links:
Example Progress Step Bars:
Example flipping a box on click
Misc:
Collection of articles on ember.js that have helped me learn:
create role pguser with superuser login password 'test';
]]>
rails new backend -T -d postgresql
cd backend
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
bundle install
default: &default
adapter: postgresql
....
....
host: localhost
username: pguser
password: test
bundle exec rails generate rspec:install
bundle exec spring binstub --all
bundle exec rake db:create db:migrate db:seed
bundle exec rails generate model contact first_name:string last_name:string email:string title:string
sudo dnf install nodejs npm
npm install -g bower
npm install -g phantomjs
npm install -g ember-cli
ember new $NAME
cd $NAME
npm install
bower install
bower install --save-dev bootstrap
app.import('bower_components/bootstrap/dist/css/bootstrap.min.css');
app.import('bower_components/bootstrap/dist/js/bootstrap.min.js');