Tuesday, March 25, 2014

The DOM

DOM
The Document Object Model (DOM) is an API for manipulating HTML and XML documents. It provides a structural representation of the document, enabling you to modify its content and visual presentation by using a scripting language such as JavaScript.
https://developer.mozilla.org/en-US/docs/DOM


The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents.[1] Objects in the DOM tree may be addressed and manipulated by using methods on the objects. The public interface of a DOM is specified in its application programming interface (API). The history of the Document Object Model is intertwined with the history of the "browser wars" of the late 1990s between Netscape Navigator and Microsoft Internet Explorer, as well as with that of JavaScript and JScript, the first scripting languages to be widely implemented in the layout engines of web browsers.
http://en.wikipedia.org/wiki/Document_Object_Model

DOM elements
http://ejohn.org/blog/html-5-data-attributes/

Wednesday, February 5, 2014

Exploding Git Day 14 & 15

I added a couple of missing images that were casuing errors when rails server ran. They were fancy product design images. ajax-loader and grid. I added them and then tried to grep for where the links were to them. This is when I discovered that my master was different from the real master.

Somehow I managed to merge master with master or something, anyways my master was messed up.
The series of things Kurtis had me do to get back to the real master:
  •   574  history | grep git
  •   575  git log
  •   576  git checkout origin/master
  •   577  git fetch
  •   578  git branch -D master
  •   579  git checkout -b master
  •   581  git branch
  •   582  git checkout fancyproduct-missing-images
  •   583  git log
  •   584  git reset --soft HEAD^1
  •   585  git status
  •   586  git stash
  •   587  git checkout master
  •   588  git branch -D fancyproduct-missing-images
  •   589  git checkout -b fancyproducy-missingimages
  •   590  git stash apply
  •   591  git add .
  •   596  git status
  •   597  git add .
  •   598  git commit -m 'adds images ajaxloader grid and updates fancyproductdesigner css'
  •   599  git branch
  •   600  git push origin fancyproducy-missingimages
  •   601  history | grep git
I also made sure all the static pages were correct.


I Exploded Git again!
Arrghh.  This is what I think happened:

I was fixing a pull request to remove the changes to db/schema.rb

When I was doing the edits before I did the push I had to run $rake db:migrate so it updated the database.
When I did a   $ git add .  it added the changes to the database

Kurtis wanted me to get rid of those changes from the pull request.

In order to do this I went back to my branch and ran
  $ git reset --soft HEAD^ 
I tried to push and it kept being rejected.

I did a  $ git pull . master 
tried to push and it was still rejected so I had to force push because I rewrote the history

I did  $ git push --force 
WHICH WAS BAD! Never git force without specifying what branch name or which remote.
(The remote is origin or upstream)
This eneded up forcing all my branches to the master on github which erased all the commits that Kurtis had made too. Luckily he still had his remote branches and could re-push them. Phew. That would have been an actual disaster.

What I should have done was
 $ git push --force origin branch_name


 $ git log -p  is git log --pretty=oneline
http://gitready.com/advanced/2009/01/20/bend-logs-to-your-will.html
http://gitimmersion.com/lab_10.html

473  git reset soft HEAD^1

  474  git reset --soft HEAD^1
  477  git status
  479  git reset HEAD db/schema.rb
  480  git status
  481  git add public/beta.html
  482  git commit -m 'undid the changes to db/schema'
  483  git branch
  484  git push origin public-images
  485  git push origin public-images
  486  git checkout -- db/schema.rb
  487  git status
  488  git push origin public-images
  489  git pull . master
  490  git status
  491  git push origin public-images
  492  git pull --rebase . master
  493  git status
  494  git push origin public-images
  495  git push --help
  496  git status
  497  git log -b
  498  git log -p
  499  git branch
  500  history | grep git








Tuesday, February 4, 2014

Active Admin Gem

I am watching the RailsCast on Active Admin #284 Active Admin Sep 19, 2011 Even though it's old it's giving me the basic idea.

I uploaded photos to the admin page via Active Admin

Googling Multi-Tenancy Analytics:
http://webmasters.stackexchange.com/questions/19237/tracking-multiple-domains-and-subdomains-on-one-analytics-profile

Tuesday, January 21, 2014

Day4 WeBrand Ruby Standard Library abbrev

Day 4 was an abort mission. Kurtis and I met at Cafe Primo while Kevin & Brandon were away at Sundance. The internet was too slow to work there so Kurtis told me to take the rest of the day off and to play with the Ruby Standard library.

It took me several days and a mini melt down to figure out how to do that. Finally on Monday after going back to Learn Ruby the Hard Way exercise 12 I realized that all you have to do is open a new whatever.rb file and require the gem then you can screw around with it.

I looked up documentation on the abbrev gem. Here are some good links:
http://endofline.wordpress.com/2010/12/25/ruby-standard-library-abbrev/
http://www.aimred.com/news/developers/2010/05/11/rediscovering_ruby_abbrev/

I called the method .abbrev on a the string "elephant" and it returned:
eelephantelephanelephantelephantelephanteleelephantelephelephantelephaelephantelepelephantelelephant
broken into lines it looks like this:
e
elephant
elephan
elephant
elephant
elephant
ele
elephant
eleph
elephant
elepha
elephant
elep
elephant
elelephant


$ gem search -r post_install
*** REMOTE GEMS ***
post_install (0.0.2)

$ gem search -i post_install # installed?
false

Gems
http://net.tutsplus.com/tutorials/ruby/ruby-for-newbies-working-with-gems/

I didn't realize that rails is a gem. Wow.

Tutorials:
http://net.tutsplus.com/sessions/ruby-for-newbies/

https://www.ruby-toolbox.com/

http://guides.rubygems.org/

https://www.ruby-lang.org/en/libraries/

Thursday, January 16, 2014

Day 3 Webrand Platforming Day

At Trails Cafe for our first platforming location.

My tasks today

In the admin/products panel

change out old logo to new log
  not sure what the new logo is

add horizontal stripes to the table
  <table class="table table-striped">
  http://getbootstrap.com/2.3.2/base-css.html

make the heading products smaller and change new to a + symbol
  done

get rid of the word "ADD" between the sizes
  in _products.html  changed
  <td class="sizes"><%= product.sizes.to_sentence %></td> to
  <td class="sizes"><%= product.sizes.to_sentence(last_word_connector: ',') %></td>

change the "A star logo in the footer to the WB logo
  <div><%= image_tag 'wb-teal-logo.png', :size => "75x75" %></div>

add a sort area to sort by mens, womens etc.
  I didn't get to this.

Re-factor Controllers
  Kurtis wants me to go through the controllers and do some re-factoring.
  I looked at some of them. I don't really know where to start because I don't really know much about controller best practices. I found a few articles I am going to read.




  

Wednesday, January 15, 2014

Day 2 WeBrand Pairing Ack Grep

We created a user for me so I can be an admin. I started to fix some issues.

Fixed issues: 

  • We want to remove the unused links on the admin layout so that customers don't see the bad links.
  • Delete Social Links on admin/products page
  • Switch admin/products footer to startuplife footer
  • Create partial of footer app/_footer

Talked with Kevin (co-founder) about admin layout. Changes to be made tomorrow.

Previously I was using Grep to locate files but Kurtis said I should checkout Ack
So I did and I installed Ack http://beyondgrep.com/install/
I need to go through the documentation and play with it a bit.

Law of Demeter don't chain methods together because the expectation on them all returning something. if one returns nil the entire chain breaks.

I realized that rails console is just a version of irb

Tuesday, January 14, 2014

First Day at WeBrand with Kurtis

Yak Shaving Day at WeBrand

Installing RVM again https://rvm.io/rvm/install hope I don't have to implode it again. Last time it broke everything but I was unclear how to even use it so this time I am hoping to learn it properly.

Signing the contract!!

Installing RVM https://rvm.io/rvm/install

Cloning

List remote branches: git remote branch -v   http://gitready.com/intermediate/2009/02/13/list-remote-branches.html

Installing Mysql
  Because I run Linux Ubuntu I had to follow these directions:
    http://ariejan.net/2007/12/12/how-to-install-mysql-on-ubuntudebian/
  When I ran bundle install the mysql2 gem wouldn't work so:
    I did a gem install mysql2 -v '0.3.13'
    That didn't work so I contacted Lars and Kurtis found this link:
      http://stackoverflow.com/questions/3608287/error-installing-mysql2-failed-to-build-gem-native-extension
     I ran $ sudo apt-get install libmysql-ruby libmysqlclient-dev
       Lars' directions: $ apt-get install build-essential libmysqlclient-dev
       if it still complains then try the
       $ apt-get install libmysql-ruby
   and when I ran the bundle install it worked this time.

Seeding the Database:
These are rake commands:
$ SEED_DATA=product bundle exec rake db:create db:migrate db:seed

$ SEED_DATA=pointlessmerch_entries bundle exec rake db:seed

$ SEED_DATA=pointlessmerch bundle exec rake db:seed

Tried to bundle install again and ran into a postgress error:
  PG::Error (fe_sendauth: no password supplied
So I used these directions: http://stackoverflow.com/questions/12452073/trying-to-set-up-postgres-for-ror-app-getting-error-fe-sendauth-no-password
    sudo gvim /etc/postgresql/9.1/main/pg_hba.conf
Lars says: $ sudo su - postgres
                 Then psql

I changed the pg_hba.conf  methods to trust.
Once I did that I restarted $ sudo service postgresql restart

Set up a user in pg
I get this error:createuser: could not connect to database postgres: FATAL:  role "root" does not exist

Google:postgres setup root user
This solved it:
sudo -s -u postgres
createuser -d

Then I seeded the database 
$ SEED_DATA=product bundle exec rake db:create db:migrate db:seed

$ SEED_DATA=pointlessmerch_entries bundle exec rake db:seed

$ SEED_DATA=pointlessmerch bundle exec rake db:seed

I ran $ bundle exec rails s   and it worked.

I now have a local copy of webrand.