-
Set a default field on a component in ngrx
Imagine we have a flash message component and it has 2 required fields, severity and message; 2 optional fields, id and dismissable. In flash-message.reducer.ts, flash message interface defined as: export interface FlashMessage { id: string; severity: 'success' | 'info' | 'warning' | 'danger'; message:…
-
keydown and keyup with jQuery Steps
We have a legacy app using jQuery Steps for its wizard. Now we'd like to add some word count/line count alert inside the wizard input area. Our textarea defined: <textarea id="customized-text" data-toggle="tooltip" data-placement="top" maxlength="80"…
-
A Quick Tip for Delayed Job in Rails
I've been pondering on this delayed job in the Rails app. User specify a time that they'd like the job to run. Passing that into the delayed job is straight forward. CustomerEmail.delayed_job(queue: 'mail', run_at: params[:date]) But when I checked…
-
Nested Radio Button Inside Checkbox
I've come to write a form, where inside each checkbox, there're two radio buttons associated. HTML code looks like this: <div> <input checked="checked" id="contact_id_" name="contact_id[]" type="checkbox" value="15098&…
-
Pushed to Wrong GIT Branch
Suppose there are multiple git branches that are in your local repo. You've done tons of work, eventually committed and pushed. Then, you found you were working at a wrong branch! And pushed changes to a wrong branch remotely too! Ooops... What to do? First, see which branch…
-
A simple example using Flux
Recently at work, I was pulled into a project where React is used to generate a nested form and aggregate them at the end for a user. React is pretty good at handling the nested form display based on conditions selected by the user on the fly. The problem comes…