Skip to content

Instantly share code, notes, and snippets.

View hangsopheak's full-sized avatar
🏠
Working from home

Hang Sopheak hangsopheak

🏠
Working from home
  • Okoone
  • Phnom Penh
View GitHub Profile
// Sample
@Override
public void onBindViewHolder(@NonNull ExpenseViewHolder holder, int position) {
Expense expense = expenses.get(position);
holder.title.setText(expense.getTitle());
holder.amount.setText(expense.getAmount() + " " + expense.getCurrency());
// Navigate to DetailExpenseActivity and pass only the expense ID
holder.itemView.setOnClickListener(v -> {
Intent intent = new Intent(holder.itemView.getContext(), DetailExpenseActivity.class);
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
public class ExpenseData {
private static final List<Expense> expenses = new ArrayList<>();
import java.util.UUID;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class Expense {
private String id;
private String remark;
private double amount;
private String currency;

Definition (Code Smells) Code smells are common code anti-patterns which could and should be refactored.

This doc is summarized from Martin Flower's book Refactoring (the 2nd Edition).

Refactoring is all about Change

  • You may inverse previous refactorings as software grows
  • You may change names of a function/parameter/varible/... as you learn

How to use this doc

Go to a section of code smell, and the refactoring techniques to that smell are written in Pascal Case under the Solution section. Refer to the book's catalog to get detailed examples and explainations for each refactoring technique.

Table of Code Smells

@hangsopheak
hangsopheak / GoogleHackMasterList.txt
Created March 15, 2021 01:51 — forked from gabsoftware/GoogleHackMasterList.txt
The definitive super list for "Google Hacking".
admin account info" filetype:log
!Host=*.* intext:enc_UserPassword=* ext:pcf
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd
"AutoCreate=TRUE password=*"
"http://*:*@www&#8221; domainname
"index of/" "ws_ftp.ini" "parent directory"
"liveice configuration file" ext:cfg -site:sourceforge.net
"parent directory" +proftpdpasswd
Duclassified" -site:duware.com "DUware All Rights reserved"
duclassmate" -site:duware.com
@hangsopheak
hangsopheak / gist:efbdf0800e33f4ac6a1a25f6d7589f13
Created August 7, 2018 07:27 — forked from roshanpal/gist:37acd854a889f7b73a1c
PHP AES Encryption/Decryption Class with PKCS5 padding
<?php
/**
* Created by PhpStorm.
* User: roshan
* Date: 4/5/15
* Time: 2:46 PM
*/
class Aes