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…
Category: my-work.log
Codes, my-work.log
How To Time Travel Using ActiveSupport TimeHelpers
by Kat Padilla • • 2 Comments
So I needed to test “time”…quite literally. I needed to test some time-related validity logic in Rails. I read that in Rails 4.1, ActiveSupport::Testing::TimeHelpers was added to make it easier for everyone to withstand the test of time. Err, I mean to test time. No disrespect to TimeCop, I know it has its own advantages, but the built-in…
Codes, my-work.log
Service Object Adventures
by Kat Padilla • • 0 Comments
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…
Codes, my-work.log
ActiveRecord::Store for Settings
by Kat Padilla • • 0 Comments
Using the config.yml it’s fairly easy to store app settings that we want to be able to change quickly between environments. That is cool until your boss tells you that they need to be able to change it on the app itself a.k.a. on the fly. The initial advice that I got for this kind…
Codes, my-work.log
RSpec Adventures
by Kat Padilla • • 0 Comments
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…
my-work.log
Docker For WordPress Dev Environment
by Kat Padilla • • 0 Comments
Note: I am not a Docker expert. These are just my personal notes for my local WP development environment using WordPress x Docker x Fig. Here’s the final and improved version of this which will take the pain out of setting up. Just run start.sh and then your WP instance is good to go: https://github.com/katpadi/wp-starter…
Codes, my-work.log
A-Footer-Link2Page-Widget
by Kat Padilla • • 0 Comments
A swaggy simple WordPress widget that lets you add a link of an existing page to your footer.
Codes, my-work.log
TIL about wp_list_pluck
by Kat Padilla • • 0 Comments
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’,…
Codes, my-work.log
.gitignore All The Files!
by Kat Padilla • • 0 Comments
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…
Codes, my-work.log
WP Local Instance Installer
by Kat Padilla • • 0 Comments
Of course, I am back to my WP projects. I’ve had some taste of RoR for the past few weeks but all things come to an end. At least for now. Our QA engineer once wanted to install a copy of the site that I was developing but we didn’t have the staging server up…