KatPadi's Point

Category: my-work.log

Git: Squash Commits

With git it’s possible to squash previous commits into one before sharing them with others. Step 1 For example you want to squash your last 3 commits: git rebase -i HEAD~3 On the other hand, if you want to just simply squash all the unpushed commits: git rebase -i origin/master If you have many commits and…

Service Object Adventures

I have read a lot of Rails articles and most of them always tell you to keep your Rails controllers skinny. It sounds so easy but it’s really not. As the cliche goes, “it is easier said than done.” In real life, requirements get complicated. Controllers and models get longer and longer and you need to do something about…

RSpec Adventures

RSpec is an awesome tool for behaviour-driven testing. It’s mostly used in test driven development (“TDD”), where the developer writes the test based on what the application should do, and then creates the program to accomplish the goals of the test. At first, I found this tedious because it means extra work for me (the developer). But in the long…

TIL about wp_list_pluck

Today I learned about a powerful WordPress function that can create a new array from an object. According to its WP Codex description, it does the ff: Pluck a certain field out of each object in a list (Kind of a straightforward definition lol) // Say this is our array $player_info = array( array( ‘name’ => ‘Kobe Bryant’,…

.gitignore All The Files!

This is an example of a .gitignore file that will ignore all files except the ones you specify. This is what I’ve been using for my WordPress development. Note: This is a product of constant research (aka Google-ing) and failed development practices. /* !.gitignore !themes themes/* !themes/katpadi-theme The first line says that it will ignore ALL…