Devchat.tv Episode Roundup

Devchat.tv Episode Roundup

Download on the App Store

All Devchat.tv Episode Roundup episodes

  • Investing in Your Knowledge Portfolio

    In the Pragmatic Programmer it talks about your knowledge portfolio and recommend that you invest in it regularly. In fact, it draws the analogy of a stock or financial investor and how they invest.

    I discuss my experience in investing and my thoughts on the content of the Pragmatic Programmers book.

    The only major difference or disagreement I have between their suggestions and my experience is that today most of the content you’d find in books or trade magazines is available online in blogs, videos, and other media. However, in some cases, the best documentation is in a recently written and maintained book.

    Here are some of the things I mentioned in the podcast:

    • Ruby Reloaded Peter Cooper’s Ruby Course
    • Teach Me To Code Academy – Ruby on Rails Course
    • The The Pragmatic Programmerbook
    • 21 min
    • Create a ‘Like’ or ‘+1′ button with make_flaggable
      With the recent release of the Google Plus beta (ask me for an invite if you want one), I felt it appropriate to show a simple way to create a Like or +1 button for your Rails application. The app and concept is pretty simple, so I won't worry about posting the code below.
      Install:
      gem 'make_flaggable', :git => 'git://github.com/cavneb/make_flaggable.git'
      bundle install
      rails generate make_flaggable
      rake db:migrate
      Models:
      class Article < ActiveRecord::Base
      make_flaggable :like
      end
      class User < ActiveRecord::Base
      make_flagger
      end
      Links:
      https://github.com/medihack/make_flaggable
      https://github.com/cavneb/make_flaggable
      Download 93.4 MB
      Download (iPod & iPhone) 43.9 MB
      0 min
    • Create a ‘Like’ or ‘+1′ button with make_flaggable
      With the recent release of the Google Plus beta (ask me for an invite if you want one), I felt it appropriate to show a simple way to create a Like or +1 button for your Rails application. The app and concept is pretty simple, so I won't worry about posting the code below.
      Install:
      gem 'make_flaggable', :git => 'git://github.com/cavneb/make_flaggable.git'
      bundle install
      rails generate make_flaggable
      rake db:migrate
      Models:
      class Article < ActiveRecord::Base
      make_flaggable :like
      end
      class User < ActiveRecord::Base
      make_flagger
      end
      Links:
      https://github.com/medihack/make_flaggable
      https://github.com/cavneb/make_flaggable
      Download 93.4 MB
      Download (iPod & iPhone) 43.9 MB
      0 min
    • Create a ‘Like’ or ‘+1′ button with make_flaggable
      With the recent release of the Google Plus beta (ask me for an invite if you want one), I felt it appropriate to show a simple way to create a Like or +1 button for your Rails application. The app and concept is pretty simple, so I won't worry about posting the code below.
      Install:
      gem 'make_flaggable', :git => 'git://github.com/cavneb/make_flaggable.git'
      bundle install
      rails generate make_flaggable
      rake db:migrate
      Models:
      class Article < ActiveRecord::Base
      make_flaggable :like
      end
      class User < ActiveRecord::Base
      make_flagger
      end
      Links:
      https://github.com/medihack/make_flaggable
      https://github.com/cavneb/make_flaggable
      Download 93.4 MB
      Download (iPod & iPhone) 43.9 MB
      0 min
    • The DRY Principle
      According to The Pragmatic Programmer by Andy Hunt and Dave Thomas, "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system."
      Last week I talked about extending your Ruby on Rails application. This is because in many cases in order to avoid repeating your logic across multiple classes (models or controllers) you need another place to put your functionality.
      Mix-in modules, plugins, and single table inheritance all allow you to codify your knowledge into a single place depending on what you’re working with.
      The DRY principle is more than just a way to avoid having to update multiple files when something changes. Rather, it’s a way of assuring yourself that things are done in a consistent manner.
      It also helps you when you’re trying to find something in your application because there’s only one place where it can be found.
      8 min
    • Pivotal Labs’ Javascript Setup

      One of my clients had Pivotal Labs build them a website. After Pivotal Labs finished the project, they helped them find a developer to maintain it for them. I took over from him.

      This last week, I had to dig deeply into the javascript code to make a piece of functionality I was modifying conform to what they had in other places on the site. What happened during the two days I worked on it was that I learned how they had things set up. Here are some of the things I found.

      Jelly

      Jelly provides you with an extension to the JQuery framework that allows you to trigger callbacks from your Rails controller. It’s exceptionally useful for things you need to occur when your server call is completed.

      Namespaced Functions

      The Pivotal Labs developers put a lot of things under a namespace named after the project. They further namespaced functions under namespaces corresponding to controllers and widgets, with some functions matching up with action names where widgets and other functionality could be implemented and initialized.

      This is really handy in cases where you need specific functionality only is specific cases.

      Javascript Loading at the end of the page

      Finally, a method in the ApplicationHelper was provided that added all of the requisite javascript files to an array and then called javascript_include_tag on the array to include all of the files. This was done at the bottom of the page to avoid holding up the rest of the page loading while waiting for assets.

      This also allowed for functions that required the DOM to be loaded to simply be called instead of using the JQuery $(function(){…}) callback style.

      16 min
    • Building a Star-Rating System in Ruby on Rails with jQuery
      Specification
      Clicking a star rating turns on the stars to the left of the star I clicked.
      Clicking a star submits the star rating.
      When I refresh the page, the star ratings should be persistent.
      We’ll be using Rails’ functions including:
      form_for
      hidden_field
      Rails Helpers
      We’ll be using jQuery functions including:
      click
      each
      ajax
      <% form_id = "movie_#{movie.id}_rating" %>
      <%= form_for movie.ratings.last || movie.ratings.build, :html => {:id => form_id , :class => "star_rating_form"} do |f| %>
      <%= f.hidden_field :movie_id %>
      <%= f.hidden_field :stars, :id => form_id + "_stars" %>
      <% end %>
      <% (1..5).each do |i| %>
    • <% end %>
      var set_stars = function(form_id, stars) {
      for(i=1; i <= 5; i++){
      if(i <= stars){
      $('#' + form_id + '_' + i).addClass("on");
      } else {
      $('#' + form_id + '_' + i).removeClass("on");
      }
      }
      }
      $(function() {
      $('.rating_star').click(function() {
      var star = $(this);
      var form_id = star.attr("data-form-id");
      var stars = star.attr("data-stars");
      $('#' + form_id + '_stars').val(stars);
      $.ajax({
      type: "post",
      url: $('#' + form_id).attr('action'),
      data: $('#' + form_id).serialize()
      })
      });
      $('.star_rating_form').each(function() {
      var form_id = $(this).attr('id');
      set_stars(form_id, $('#' + form_id + '_stars').val());
      });
      });
      0 min
    • Building a Star-Rating System in Ruby on Rails with jQuery
      Specification
      Clicking a star rating turns on the stars to the left of the star I clicked.
      Clicking a star submits the star rating.
      When I refresh the page, the star ratings should be persistent.
      We’ll be using Rails’ functions including:
      form_for
      hidden_field
      Rails Helpers
      We’ll be using jQuery functions including:
      click
      each
      ajax
      <% form_id = "movie_#{movie.id}_rating" %>
      <%= form_for movie.ratings.last || movie.ratings.build, :html => {:id => form_id , :class => "star_rating_form"} do |f| %>
      <%= f.hidden_field :movie_id %>
      <%= f.hidden_field :stars, :id => form_id + "_stars" %>
      <% end %>
      <% (1..5).each do |i| %>
    • <% end %>
      var set_stars = function(form_id, stars) {
      for(i=1; i <= 5; i++){
      if(i <= stars){
      $('#' + form_id + '_' + i).addClass("on");
      } else {
      $('#' + form_id + '_' + i).removeClass("on");
      }
      }
      }
      $(function() {
      $('.rating_star').click(function() {
      var star = $(this);
      var form_id = star.attr("data-form-id");
      var stars = star.attr("data-stars");
      $('#' + form_id + '_stars').val(stars);
      $.ajax({
      type: "post",
      url: $('#' + form_id).attr('action'),
      data: $('#' + form_id).serialize()
      })
      });
      $('.star_rating_form').each(function() {
      var form_id = $(this).attr('id');
      set_stars(form_id, $('#' + form_id + '_stars').val());
      });
      });
      0 min
    • Building a Star-Rating System in Ruby on Rails with jQuery
      Specification
      Clicking a star rating turns on the stars to the left of the star I clicked.
      Clicking a star submits the star rating.
      When I refresh the page, the star ratings should be persistent.
      We’ll be using Rails’ functions including:
      form_for
      hidden_field
      Rails Helpers
      We’ll be using jQuery functions including:
      click
      each
      ajax
      <% form_id = "movie_#{movie.id}_rating" %>
      <%= form_for movie.ratings.last || movie.ratings.build, :html => {:id => form_id , :class => "star_rating_form"} do |f| %>
      <%= f.hidden_field :movie_id %>
      <%= f.hidden_field :stars, :id => form_id + "_stars" %>
      <% end %>
      <% (1..5).each do |i| %>
    • <% end %>
      var set_stars = function(form_id, stars) {
      for(i=1; i <= 5; i++){
      if(i <= stars){
      $('#' + form_id + '_' + i).addClass("on");
      } else {
      $('#' + form_id + '_' + i).removeClass("on");
      }
      }
      }
      $(function() {
      $('.rating_star').click(function() {
      var star = $(this);
      var form_id = star.attr("data-form-id");
      var stars = star.attr("data-stars");
      $('#' + form_id + '_stars').val(stars);
      $.ajax({
      type: "post",
      url: $('#' + form_id).attr('action'),
      data: $('#' + form_id).serialize()
      })
      });
      $('.star_rating_form').each(function() {
      var form_id = $(this).attr('id');
      set_stars(form_id, $('#' + form_id + '_stars').val());
      });
      });
      0 min