Skip to content

Instantly share code, notes, and snippets.

View hiendinhngoc's full-sized avatar
🐉
Focusing

Dinh Ngoc Hien hiendinhngoc

🐉
Focusing
View GitHub Profile
@hiendinhngoc
hiendinhngoc / fizzy_cli.md
Last active December 15, 2025 09:24
fizzy-cli overview

The repo: https://github.com/robzolkos/fizzy-cli

The fizzy-cli application uses the Thor gem to create a structured and modular command-line interface. Here's an explanation of how the commands are created and used, based on the analysis of the codebase.

  1. The Core Framework: Thor

The application is built on top of Thor, a powerful toolkit for building CLIs in Ruby. Thor provides a simple way to define commands, options, and subcommands, and it automatically generates help text.

The Unofficial 37signals/DHH Rails Style Guide

About This Document

This style guide was generated by Claude Code through deep analysis of the Fizzy codebase - 37signals' open-source project management tool.

Why Fizzy matters: While 37signals has long advocated for "vanilla Rails" and opinionated software design, their production codebases (Basecamp, HEY, etc.) have historically been closed source. Fizzy changes that. For the first time, developers can study a real 37signals/DHH-style Rails application - not just blog posts and conference talks, but actual production code with all its patterns, trade-offs, and deliberate omissions.

How this was created: Claude Code analyzed the entire codebase - routes, controllers, models, concerns, views, JavaScript, CSS, tests, and configuration. The goal was to extract not just what patterns are used, but why - inferring philosophy from implementation choices.

@hiendinhngoc
hiendinhngoc / org.rb
Created July 18, 2025 02:53
Export data
#!/usr/bin/env ruby
require 'pg'
require 'fileutils'
require 'json'
require 'set'
RESERVED_WORDS = {
"column" => "\"column\"",
"default" => "\"default\"",
@hiendinhngoc
hiendinhngoc / todo.md
Last active April 23, 2024 07:44
Todo list for shop game - generated by AI

HTML Structure

  1. Create an index.html file and set up the basic HTML structure (head, body, etc.).
  2. Create elements for:
  • Header section (logo, search bar)
  • Game list/gallery container
  • Game item elements (image, title, price, etc.)
  • Genre/category filter buttons container
  • Footer section

HTML Structure - Game Item

@hiendinhngoc
hiendinhngoc / list_api.md
Created June 15, 2023 04:08
List APIs affected by update order item type

List APIs:

  1. Direct
    1. updateOrderItem
  2. Indirect
    1. order_type
      1. cm_sdi_record_type
        1. → cmSdiCreateRecord
        2. → mSdiHeaderMapRecord
  3. → cmSdiProcessRecord
@hiendinhngoc
hiendinhngoc / gift_campaign_progress.md
Created November 29, 2022 08:24
Gift campaignn progress

Overview

  • Thành tích cộng dồn của các chương trình quà tặng type B được lưu vào table gift_campaign_progresses. Mỗi record sẽ tương ứng với 1 chương trình và 1 khách hàng và bao gồm các data field liên quan tới số lượng, doanh số của các mã hàng liên quan đến chương trình (các mã hàng trong gift_condition_items của variant_gift) và số giải thưởng ở các trạng thái khác nhau.

  • Thành tích về doanh số (revenue) sẽ được tính dựa trên giá sau chiết khấu bao gồm thuế của mã hàng mua.

  • Mỗi gift_campaign_progress sẽ có nhiều gift_campaign_progress_items, tương ứng với từng gift_condition_item của chương trình mà KH đã chọn mua. Ví dụ chương trình yeu cầu mua 100c A, B, C để đạt quà. Khách đã mua 200A và 50B, thì sẽ có 2 gift_campaign_progress_items cho A và B, ghi nhận SL và DS đã mua cho 2 mã này. Vì mã C chưa đặt mua, nên sẽ ko có record tương ứng ==> chỉ tạo progress items khi khách đặt mua (hoặc đặt mã hàng vào giỏ hàng) để tránh tình trạng hàng loạt progress items được tạo nhưng ko dc sử

import React from "react"
import PropTypes from "prop-types"
export default class LogIn extends React.Component {
constructor(props) {
super(props);
this.state = {
email: '',
email_ready: undefined,
password: '',

Keybase proof

I hereby claim:

  • I am hiendinhngoc on github.
  • I am hiendinhngoc (https://keybase.io/hiendinhngoc) on keybase.
  • I have a public key ASA0QPOhLfIBYucn6RIOsB7AnpzlRMC3PL7KfWdFagMfiwo

To claim this, I am signing this object:

require 'csv'
start = Date.new(Date.today.year, 1)
finish = Date.new(Date.today.year, 2).end_of_month
#campaigns = Campaign.includes(:transactions).where.not(:transactions => { :id => nil })
transactions = Transaction.joins(:campaign).where.not(campaign_id: nil).where(created_at: start..finish)
column_headers = ["Campaign", "Amount", "Date"]
def download_all_post_contents
posts = @campaign.posts
if posts.present?
folder = "/tmp"
file = "/tmp/archive#{Time.now.to_i}_.zip"
urls = []
posts.each do |post|
urls << post.filestack_image_url if post.filestack_image_url.present?
urls << post.photo_attributes('original')['url'] if post.photo.present?