Top Banner
GEMS Thursday, February 7, 13
28

5 Favorite Gems (Lightning Talk(

Jun 28, 2015

Download

Documents

Mark

Presented at BostonRB Project Night, February 5th, 2013
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 5 Favorite Gems (Lightning Talk(

GEMSThursday, February 7, 13

Page 2: 5 Favorite Gems (Lightning Talk(

@markbates

Thursday, February 7, 13

Page 3: 5 Favorite Gems (Lightning Talk(

Thursday, February 7, 13

Page 4: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tv

PROJNIGHT213

Thursday, February 7, 13

Page 5: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

1. Konacha

Thursday, February 7, 13

Page 6: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

JavaScript/CoffeeScripttesting for Rails

Thursday, February 7, 13

Page 7: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

describe  "Calculator",  -­‐>      beforeEach  -­‐>        @calculator  =  new  Calculator()      context  "add",  -­‐>          it  "adds  two  numbers",  -­‐>            @calculator.add(2,  2).should.eql(4)          context  "null  numbers",  -­‐>              it  "throws  an  exception",  -­‐>                expect(=>                    @calculator.add(1,  null)                ).to.throw(NullNumberError)

describe("Calculator",  function()  {      beforeEach(function()  {        this.calculator  =  new  Calculator();    });      context("add",  function()  {          it("adds  two  numbers",  function()  {            this.calculator.add(2,  2).should.eql(4);        });          context("null  numbers",  function()  {              it("throws  an  exception",  function()  {                var  _this  =  this;                expect(function()  {                    _this.calculator.add(1,  null);                }).to["throw"](NullNumberError);            });          });      });  });

CoffeeScript JavaScript

Thursday, February 7, 13

Page 8: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

https://github.com/jfirebaugh/konacha

http://visionmedia.github.com/mocha/

http://chaijs.com/

More Info

http://www.metacasts.tv/casts/unit-testing-javascript-in-rails

Thursday, February 7, 13

Page 9: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

2. SideKiq

Thursday, February 7, 13

Page 10: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

Super fast background workers

Thursday, February 7, 13

Page 11: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

class  MyWorker    include  Sidekiq::Worker    sidekiq_options  unique:  true      def  perform(some_attributes)        #  do  some  work  here    end  end  MyWorker.perform_async(some_attributes)

Thursday, February 7, 13

Page 12: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

Thursday, February 7, 13

Page 13: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

http://sidekiq.org/

https://github.com/mperham/sidekiq

More Info

Thursday, February 7, 13

Page 14: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

3. SunSpot

Thursday, February 7, 13

Page 15: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

Simple full-textsearch using Solr

Thursday, February 7, 13

Page 16: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

class  Post  <  ActiveRecord::Base    searchable  do        text  :title,  :body        text  :comments  do            comments.map  {  |comment|  comment.body  }        end        integer  :blog_id        integer  :author_id        integer  :category_ids,  multiple:  true        time  :published_at        string  :sort_title  do            title.downcase.gsub(/^(an?|the)\b/,  '')        end    endend

Post.search  do    fulltext  'best  pizza'    with  :blog_id,  1    with(:published_at).less_than  Time.now    order_by  :published_at,  :desc    paginate  page:  2,  per_page:  15    facet  :category_ids,  :author_idend

Thursday, February 7, 13

Page 17: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

http://sunspot.github.com/

https://github.com/sunspot/sunspot

More Info

http://lucene.apache.org/solr/

Thursday, February 7, 13

Page 18: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

4. Sinatra

Thursday, February 7, 13

Page 19: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

A DSL for quickly creating Ruby Web Apps

Thursday, February 7, 13

Page 20: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

require  'sinatra'  get  '/'  do    'Hello  world!'end

Thursday, February 7, 13

Page 21: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

require  'sinatra'  get  '/'  do    erb  :indexend  __END__  @@  index<div>Hello  World!</div>

Thursday, February 7, 13

Page 22: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

require  'sinatra/base'require  './todo'require  'sinatra/twitter-­‐bootstrap'require  './url_helpers'  class  TodoApp  <  Sinatra::Base    register  Sinatra::Twitter::Bootstrap::Assets      helpers  UrlHelpers      get  "/todos"  do        @todos  =  Todo.all        erb  :index    end      get  "/todos/new"  do        @todo  =  Todo.new        erb  :form    end      get  "/todos/:id"  do        @todo  =  Todo.find(params[:id])        redirect  edit_todo_path(@todo)    end      get  "/todos/:id/edit"  do        @todo  =  Todo.find(params[:id])        erb  :form    end      post  "/todos"  do        Todo.create(params[:todo])        redirect  todos_path    end      put  "/todos/:id"  do        @todo  =  Todo.find(params[:id])        @todo.update_attributes(params[:todo])        redirect  todos_path    end      delete  "/todos/:id"  do        @todo  =  Todo.find(params[:id])        @todo.destroy        redirect  todos_path    end  end  use  Rack::MethodOverriderun  TodoApp

Thursday, February 7, 13

Page 23: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

http://www.sinatrarb.com/

http://www.metacasts.tv/casts/building-a-sinatra-application-pt-1

http://www.metacasts.tv/casts/building-a-sinatra-application-pt-2

More Info

http://www.metacasts.tv/casts/gettings-started-with-sinatra

https://github.com/sinatra/sinatra

Thursday, February 7, 13

Page 24: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

5. Foreman

Thursday, February 7, 13

Page 25: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

Manage ApplicationCommands

Thursday, February 7, 13

Page 26: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

web:  bundle  exec  thin  start  -­‐p  3000solr:  bundle  exec  rake  sunspot:solr:runworker:  bundle  exec  sidekiq

Thursday, February 7, 13

Page 27: 5 Favorite Gems (Lightning Talk(

http://www.metacasts.tvPROJNIGHT213

https://github.com/ddollar/foreman

More Info

Thursday, February 7, 13

Page 28: 5 Favorite Gems (Lightning Talk(

@markbates

Thursday, February 7, 13