Category: Process Documentation

Use ssh-agent to save ssh passphrase in Window 10



Problem: When using SSH to connect other server, I don’t want to type passphrase everytime:)

For Windows 10 you need PowerShell to active ssh-agent in order to save passphrase.

Solution: First use Administrator right to open PowerShell (Windows PowerShell).

Then enter below command to active ssh-agent:

local Administrator PowerShell 
Set-Service ssh-agent -StnartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent

Then now you can add the key file (My file store in C:\Users\user.ssh\id_rsa), it will prompt a message to obtain the passphrase.

ssh-add C:\Users\user.ssh\id_rsa
(Enter your passphrase)

Eventually, ssh-agent will store your passphrase now. You can also enter

ssh-add -l

to check out the record.

Update npm on Windows 10


Problem: Want to deploy node.js, but npm is too old.

Solution: Run PowerShell as Administrator (search “PowerShell”, right click and select Run as Administrator)

then run below command

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade

Detect tag removed using jQuery

Problem: Want to detect a tag like <div>, when it removed, do something.

Solution: Based on this answer, we can use on’ to detect event like‘remove’:

keep in mind that you must add jQuery (v1.9.1 or above) and jQuery UI -(v1.10.2 or above) scripts in it.

For example, I want to detect a tag with class name “test”:

<div class="test">already to vanish</div>

in the jQuery script part, add below code:

$(".test").on("remove", function () {
    alert("Element was removed, do something");

Form submit not working due to hidden required field

Problem: As the title stated, the form submit function not working because of the required field that user forgot to fill, and the field itself is hidden like below code:

<input type="hidden" required name="form_field"  >

so the solution will be adding the value into that hidden value.

Remove duplicate after union two collections in Laravel 5

Problem: Having two collections/MySQL query results and combine them using union():


then want to remove all duplicate on that union result.

Solution: using unique() to remove duplicates. You can add a parameter like unique(‘id’) to specifically remove which tag name. Example:

$result1 = $result1->unique()->values()->all();

Remember to assign it to a variable or else it will remain the same.

Change localhost to correct domain path in Laravel

Problem: when resetting password or go to other routes, the path should no longer be a localhost but my new domain name. Still, the domain from URL is localhost.

Update .env file to update Laravel domain name

Solution: Update .env file, from APP_URL=http://localhost to APP_URL=

and remember to clean config setting by enter below command:

php artisan config:clear

Remove emoji function in WordPress

Problem: WordPress forced to add emoji function since version 4.2 and want to remove it.

Solution: In the theme folder that you are using, add below code to functions.php:

remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
Close Bitnami banner