Skip to content

Tag Archives: JavaScript

JavaScript: get domain from url with JS regex


It's as simple as url.match(/\/\/(.[^/]+)/)[1]. Requires the double slash before the domain part, but not a slash after it.

New in JavaScript ES6


ES6 introduces new operators and concepts, like spread operator and Sets. Introduction to ES6+

Show Popular Posts on WordPress like Tim Ferriss


Tim's blog uses DOMTabĀ for tabbing the top lists of popular posts. Tabs are populated with WordPress Popular Posts plugin and some manual lists as well. Remember to allow shortcodes in sidebar. Then add a text widget with something like: <div class="domtab"> <ul class="domtabs"> <li class="active"><a class="domtab1" href="#t1" style="cursor:pointer;">Current hits</a></li> <li><a class="domtab2" href="#t2" style="cursor:pointer;">All time</a></li> <li><a […]

Load jQuery Slideshow After Page Has Loaded


I needed a slideshow that would load (in a way, asynchronously) after the page has been loaded and would show something without JavaScript. This solution requires jQuery and jQuery Cycle plugin (lite version will do). <div id="slideshow"> <img src="default-image.jpg" alt="" /><!--defaults to this image without javascript --> </div> <script type="text/javascript"> $(document).ready(function() { //// random slides […]

JavaScript to Footer in WordPress


Want to move that jQuery and other js references from header to footer? Try JavaScript to Footer plugin.