Skip to content

Instantly share code, notes, and snippets.

nhducit nhducit

  • Ho Chi Minh
Block or report user

Report or block nhducit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View replace.js
var myString = 'EXAMPLEstring';
var myNewString = myString.replace(/[A-Z]/g, '0');
function replaceFunc (a, b, c) {
console.log(a, b, c);
return a.toLowerCase();
var myOtherString = myString.replace(/[A-Z]/g, replaceFunc);
nhducit / checkDuplicateID
Last active Aug 29, 2015
Javascript snippet to check duplicated ID in html page
View checkDuplicateID
Select all below snippet => drag and drop in browser bookmark bar
=> click on bookmark which you have just add => check the browser console
javascript:(function(){var e={};$("[id]").each(function(){var t=$('[id="''"]');if(t.length>1&&t[0]===this){;e.obj=this;e.obj2=t[0]}});console.warn("Duplicate ID:",,e.obj,e.obj2)})();
View regex-weburl.js
// Regular Expression for URL validation
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
// Copyright (c) 2010-2013 Diego Perini (
// Permission is hereby granted, free of charge, to any person
nhducit / Javascript Natural Sort Algorithm With Unicode Support
Last active Aug 29, 2015
Javascript Natural Sort Algorithm With Unicode Support
View Javascript Natural Sort Algorithm With Unicode Support
* Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
* Author: Jim Palmer (based on chunking idea from Dave Koelle)
* Reference:
function naturalSort (a, b) {
var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
sre = /(^[ ]*|[ ]*$)/g,
dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
hre = /^0x[0-9a-f]+$/i,

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
You can’t perform that action at this time.