How to close duplicated tabs in your Chrome browser

Open a New Tab
Press F12 to open Web Developer Tool
Open Console tab
Paste these code, and press ENTER to run:

chrome.tabs.query({}, function(tabs) {
    var firstSee = [];
    for (var i = 0; i < tabs.length; i++) {
        var url = tabs[i].url;
        var id = tabs[i].id;
        if (firstSee.indexOf(url) >= 0){
            chrome.tabs.remove(id);
        } else{
            firstSee.push(url);
        }
    }
})

Bonus: you can create a Bookmarklet to do it:

javascript:chrome.tabs.query({}, function(tabs) {var firstSee = [];for (var i = 0; i < tabs.length; i++) {var url = tabs[i].url;var id = tabs[i].id;if (firstSee.indexOf(url) >= 0){chrome.tabs.remove(id);} else{firstSee.push(url);}}})

Then open a New Tab, click that Bookmarklet. Done!

Advertisements

Setup and Using RAM Disk in daily development

I have quite strong QuadCore computer with 8GB RAM. Normally, my daily working basis uses nearly 6GB RAM. So 2GB more are waste. I often have to write installer script, try/test the setup, installer … which read/write a lot of files (7000 files, WTH)

So idea about RAM disk (from DOS era) come up!

Software to create RAM disk

1. ImDisk. TESTed on Win7
http://www.ltr-data.se/opencode.html/#ImDisk

2. http://www.ocztechnologyforum.com/forum/showthread.php?63273-*-Windows-7-Ultimate-Tweaks-amp-Utilities-*&s=fed9149ad42cb34e6e914b94fa7a3232&p=442160#post442160

3. I use this DataRAM RamDisk

Install it is very simple.


Create/Start new disk in DataRAM
go to Computer Manager, Disk Management, format it and assign drive letter, Fix the drive character to R: for easily reference later.

Settings/DiskSize set to your need
Load and Save/Load Disk Image at Startup, Filename = C:\RAMDISK.img
Load and Save/Save Disk Image on shutdown, Filename = C:\RAMDISK.img
Option/Do not compress image file on NTFS filesystems

Using your ram disk

Redirect Chrome cache dir

Change your Chrome shortcut, change the Target to

C:\Users\ngng\AppData\Local\Google\Chrome\Application\chrome.exe –user-data-dir=”D:\LockeVN\ChromeLockeVNWorkProfile” –disk-cache-dir=”R:\Google\ChromeDev”

Change Win7 temp path

Go to environment of OS, redirect TEMP and TMP folder to ramdisk

.
.
.
.