News for hackers. Stuff that matters.

nicolasMLV

Rails uses foreign keys by default, usually I generate a migration file with `rails generate migration AddThisToThing this:references`

Then this line is generated `add_reference :things, :this, foreign_key: true`

and then we call the migration, and there is the foreign key.

Re:BreezyPDF Lite: HTML to PDF generation as a Service on Friday June 29, 2018 @01:52PM (#17426206)
It is mainly a wrapper around this chrome headless command : (maybe you only need that)

`#{chrome_alias} --headless --disable-gpu --print-to-pdf="#{pdf_path}" "#{html_url}"`

Re:Modern Front-end in Rails on Friday December 08, 2017 @11:35AM (#15879897)
Turbolinks is the official Front-end part of Rails and it works very well, but there is no mention of it in the article neither in the hackernews comments, so i think it is under-used.

There's also turbolinks-ios and turbolinks-android, I built my mobile apps with minimal knowledge of Swift and Kotlin.

Re:Ask HN: Which developers do you closely follow? on Monday January 30, 2017 @09:05AM (#13521224)
David Heinemeier Hansson, CTO of Basecamp and Creator of Ruby on Rails https://www.twitter.com/dhh
Re:Vue.js is easier to learn than jQuery on Sunday October 30, 2016 @10:17AM (#12829898)
You could simplify this

  <script>
    var counter = 0;
    $(document).ready(function() {
      var $output = $('#output');  
      $('#increment').click(function() {
        counter++;
        $output.html(counter);
      });
      $output.html(counter);
    });
 </script>
with

  <script>
    var counter = 0;
    $(document).on('click', '#increment', function() {
        counter++;
        $('#output').html(counter);
    });
  </script>
Re:Karabiner – Easy Keyboard Remapping for OS X on Sunday October 02, 2016 @08:26PM (#12624960)
been using it for 1 year to swap keys (beer+keyboard accident...) and it works well
Re:Ask HN: How much do you make in London? on Tuesday September 27, 2016 @08:21AM (#12589027)
In 2013 I declined an offer (first job, graduate): software dev in bigco (IT Provider travel industry), £38K
You can use event delegation for button handling : `$(document).on('click', '.button-list', my_function);`

https://learn.jquery.com/events/event-delegation/

Re:Ruby on Rails Tutorial on Saturday July 30, 2016 @08:24PM (#12195218)
Great but Turbolinks 5 and Action Cable (web sockets) are missing
Let's hope Github will find a way for users to be able to 'tip' maintainers. I concede it is very hard to find the solution (Who? When? How much?)
Re:My time with Rails is up on Monday May 23, 2016 @11:10AM (#11754337)
Here is a new blogpost from DHH "Provide sharp knives"

https://m.signalvnoise.com/provide-sharp-knives-cc0a22bf7934

Just been removed from https://www.producthunt.com/upcoming although 20 upvotes