ES6 Tips in Chrome (2016-08-08)

Nowadays ES6 is more and more popular in front end development, so I plan to learn and practice it via Chrome browser. Why is Chrome? Because it can support most of ES6 features(Nearly 97% until 2016-08-08), but I also find a few method that it can't support.

  1. .at() method
  2. .padStart() method
  3. .padEnd() method
  4. .values() method

If I find other features not support in Chrome, I would write it here again.

PHP Cross-domain Setting

In the previous article 《jQuery $.ajax Method Ignored the Undefined Values》, I send a request to the server's php file, maybe you would get a cross-domain error.

XMLHttpRequest cannot load http://127.0.0.1/jq-undefined.php?para1=1&para2=2. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Read More

jQuery $.ajax Method Ignored the Undefined Values

Recently, I used jQuery to get the data from the server client via $.ajax method. As we known that, we should send the request with some parameters. The code as follow.

$(document).ready(function(){
  $.ajax({
    url:'http://127.0.0.1/jq-undefined.php',
    data:{
      para1 : 1,
      para2 : 2,
      para3 : undefined
    },
    success:function(data){
      alert(data);
    },
  });  
});

According to Chrome DevTools, I get the result:

Yep, jQuery is smart, it can ignore the undefined values and avoid a lot of server errors. If you must send a undefined value, you can write like this

$(document).ready(function(){
  $.ajax({
    url:'http://127.0.0.1/jq-undefined.php?para3=undefined',
    data:{
      para1 : 1,
      para2 : 2
    },
    success:function(data){
      alert(data);
    },
  });  
});

Copy the Command Output of Vim

When we excute the system command in the Vim(via :!command), sometimes we want to copy the output content, but it's difficult.

Read More

Solve Vim Error Unkonwn Option File (Win7 x64)

Dictionary completions is a powerful tool in Vim, but if the feature is powerful is due to you dictionary files. As I find a Vim plugin : asins/vim-dict: vim dict files, when I install it, it doesn't work, and shows the error as follows:

Unknown option: Files

Read More

Useful jQuery .eq() method

I want to mark a specific li tag in the ul, the HTML code is like this:

<ul>
  <li>li-1</li>
  <li>li-2</li>
  <li>li-3</li>
  <li>li-4</li>
</ul>

Read More

Using M+ Font in VS Code

Monsopaced font is essential for a programmer, M+ FONTS is one of my favorite font. Long time ago, I used VS Code to write the code, and it's difficult to set the M+ Font.

Here is the solution.

"editor.fontFamily": "'M+ 1mn'"

Now you can see it works well :-)

Create a Chrome Extension to Inject JavaScript

Sometimes, when we browse the website pages, we want to control it, and let it do somethings by our expectation, such as close the advertisement doms automatically. As we known that JavaScript can fulfill it, so we should inject a JavaScript file and execute our own command.

Read More

Win7(x64) Can not Get the Update

Recently, I reinstall my Windows 7 SP1(x64), but I can't update the system, it always checking the update an has a high CPU usage. It's a so long time that I can't bear it. So I find a method that can accelerate it.

Two Packet

Good Luck

You should download the two packet and install it manually, restart the computer and check the update. Good luck :-)

sitemap