“Once in a while working with Rails we encounter something that makes us scratch our heads.”
http://www.bnjs.co/2015/01/14/rails-date-class-durations-and-ruby-basicobject/
“Once in a while working with Rails we encounter something that makes us scratch our heads.”
http://www.bnjs.co/2015/01/14/rails-date-class-durations-and-ruby-basicobject/
When I instantiate strings using double quotes, the Ruby intepreter has to do extra work to figure out if it needs to perform interpolation. Since extra work means reduced performance, it seems reasonable to avoid double-quoted instantiation unless it’s a necessity.
I na tym czytanie tego wpisu powinno się skończyć. Owszem, jest jakiś mikroskopijny narzut, ale dotyczy on parsowania i nie ma potem żadnego wpływu na runtime. Zamiast pisać bezsensowne benchmarki jak w tym wpisie wystarczy prosty dowód:
require "ripper"
puts Ripper.sexp(%q{"foo"}).inspect
puts Ripper.sexp(%q{'foo'}).inspect
Można też sprawdzić wygenerowany bytecode:
puts RubyVM::InstructionSequence.disasm -> { "foo" }
puts RubyVM::InstructionSequence.disasm -> { 'foo' }
100% racji @radarek, tyle tylko, że objętościowo wtedy to by raczej nie był już wpis na blogu tylko tweet albo sms
http://tenderlovemaking.com/2015/01/23/my-experience-with-minitest-and-rspec.html
Tenderlove o Rspec i Minitest ze świetną puentą w ostatnim zdaniu
Dwa linki, które pojawiły się dziś na fb Ruby on Rails Poland, których tu nie może zabraknąć. Mocny materiał.
Wlasnie chcialem to samo wrzucic. +666!
W fejsbuku zrobili Reacta i podobno ogromną aplikację, której wszyscy bali się tykać, po przepisaniu na Reacta, są w stanie teraz modyfikować nowozatrudniani programiści po kilku dniach pracy.
Czy ktoś może to potwierdzić podobnym doświadczeniem?
Gość jest napalony jak 150, fajnie się to ogląda.
Póki co, chwalą:
"What is React and why should you use it?
The React home page answers the “what” pretty well. If you ask me, I’d define React as a “JavaScript-based UI rendering engine.” Notice I left “HTML” out of that definition. That’s because HTML is just one of many possible targets. I also left out “browser” because you can use React on the server as well. (And hopefully native apps soon.) The “engine” part of my definition reminds me of the similarity with game engines. With React, just like with a game engine, you simply specify how a given application state gets translated to a given view. If something changes, you don’t change the view. Instead, you just render again and get a new view.
This simple approach makes a whole set of problems fall away. At Zapier, we’re transitioning from Backbone views to React views, and there’s no turning back at this point. With React, there’s no extra complexity keeping your application state and view in sync. Just render, rinse, repeat. You can easily build completely isolated, reusable, and composable UI components. Nested views just become a natural extension of the way React works. If things change, refactoring views is almost fun!"
Bardzo fajny wpis, który można wykorzystać aby przekonać kogoś do Rubiego:
http://adamniedzielski.github.io/blog/2015/05/26/beautiful-ruby-convenient-rails/
Przy okazji moje odkrycie, małe a cieszy:
2.kilobytes # => 2048
3.megabytes # => => 3145728
4567.to_s(:human) # => "4.57 Thousand"
1500000.to_s(:human) # => "1.5 Million"
21.ordinalize # => "21st"
45.ordinalize # => "45th"
https://www.amberbit.com/blog/2015/6/14/closures-elixir-vs-ruby-vs-javascript/ krótka notka o jak działają domknięcia w JS, Ruby i w Elixirze
If you use both quote styles then every time you make a string you have to think about which quote style to use. You also have to change the quote style when you add or remove interpolation from an existing string. If you always use double quotes then you never have to waste any time thinking about it.
W sprawie znaków cytowania jest tylko jeden artykuł warty przeczytania: https://en.wikipedia.org/wiki/Parkinson’s_law_of_triviality
Wszystko inne można streścić w krótkich, żołnierskich słowach: rób tak, jak robi reszta zespołu.
By avoiding the scope chains outside of the relevant models, the codebase becomes less coupled and therefore easier to maintain and refactor.
http://craftingruby.com/posts/2015/06/24/say-no-to_chained-scopes.html
Dominika popełniła blogpostkę o tym jak przy użyciu Sorcery dobrać się do innych API Google.
Dobre.
If you want to lead the technology curve, start investigating whatever Martin Fowler was writing about a decade ago.
http://www.justinweiss.com/blog/2015/07/28/how-to-predict-the-future-of-programming/
Blogłem