Skip to content

Instantly share code, notes, and snippets.

View banguyenht's full-sized avatar
🤟

banguyenht

🤟
View GitHub Profile
<html>
<head>
<style>
h1 {
font-family: Calibri;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
@banguyenht
banguyenht / add-in.txt
Last active August 15, 2022 08:03
outlook add-in
# Hello World
This is content converted from Markdown!
Here's a JSON sample:
```json
{
"foo": "bar"
}
@banguyenht
banguyenht / rails joins 3 tables
Last active January 5, 2022 11:02
rails joins 3 tables
scope :abc, ->(company_id) {
A.joins(b: :c).merge(A.where(company_id: company_id)) if company_id.present?
}
@banguyenht
banguyenht / checkbox[]
Created December 27, 2021 04:13
checkbox send send an array
check_box_tag 'auth_id[]', store.first, false, id: "store_#{store.first}", disabled: @setting.store_managed
```
SQL_STRING = <<~"SQL_STRING"
SELECT COUNT(*) as total_aritcle, users.name
FROM
INNER JOIN articles ON users.id = articles.user_id
GROUP BY
users.id
SQL_STRING
```
`ActiveRecord::Base.connection.exec_query SQL_STRING`