Search By Label
pg
for PostgreSQL or mysql2
for MySQL.pg
for PostgreSQL:const { Client } = require('pg'); // Bad: Concatenation (vulnerable to SQL injection) const insecureQuery = `SELECT * FROM users WHERE username = '${inputUsername}'`; // Good: Parameterized query (prevents SQL injection) const secureQuery = 'SELECT * FROM users WHERE username = $1'; const values = [inputUsername]; const client = new Client(); client.connect(); client.query(secureQuery, values, (err, result) => { // Handle the query result client.end(); });
pointer-events
CSS property is used to control under what circumstances an element can trigger user interface events like mouse clicks and hover. It allows you to control the visibility and interaction of elements on the page.pointer-events
property can take the following values:" Hello world ".strip # => "Hello world"
Sidekiq.redis(&:flushdb)
process.nextTick()
is a function in Node.js designed to schedule a callback function to be invoked in the next iteration of the event loop. (3 - 10) % 27
-7 % 27
-7 + 27
cmd + m
git log -g main
git stash show -p stash@{0}
ctrl/cmd + \
I18n
and incorporating specific HTML
instructions, such as the requirement to set a string in bold, we follow this approach:# config/locales/en.yml en: homepage: services: title: "This is the <strong>example</strong>"
html_safe
method in views like:<h1><%= t(:title, scope: %w[homepage services]).html_safe %></h1>
HTML
tag can work effectively.ctrl/cmd + shift + a
const validPwd = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])([A-Za-z\d$@$!%*?&]|[^ ]){8,}$/;
const getPwdAndValidate = (pwdField, pwdField2) => { const validPwd = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])([A-Za-z\d$@$!%*?&]|[^ ]){8,}$/; if (pwdField === pwdField2 && validPwd.test(pwdField) && pwdField.length >= 8) { return pwdField; } else { return null; } };
:back
symbol in Rails is often used to generate a URL that represents the previous page or location the user came from. It's commonly utilized in conjunction with methods like redirect_to
redirecting users back to where they were before performing a specific action.redirect_to
you can use :back
with the redirect_to
method to send the user back to the previous page:redirect_to :back
:back
as the path in a link to create a "Back" button or link:<%= link_to 'Back', :back, class: 'btn btn-primary' %>