Skip to content

Instantly share code, notes, and snippets.

View Noviny's full-sized avatar
🦋

Noviny Noviny

🦋
View GitHub Profile
How would I execute some code each element in a collection?
Loop in JS
each loop in Ruby
Convention over configuration:
Also know as coding by convention
decrease the number of decisions a developer has to make
Common in Ruby on Rails
Example - if there is a table called “sales” the database is also called “sales”
gem 'kaminari' # Pagination
@JeffreyWay
JeffreyWay / laravel.js
Last active April 6, 2024 20:12
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {