Repeat after me: JavaScript does not have classes JavaScript has objects. Each object has a prototype, which is either null […]
Category: Javascript
Folder excludes for modern JavaScript in Sublime Text
Are you developing using Grunt, Bower and node / npm? You might want to exclude the default package folders from […]
Split a text after a maximum of X words
This function does the work. function splitAfterXWords(to_split, words){ regex = new RegExp(“(([\s;:!,.?”‘’]*[^\s]+){“” + words + “”})(.*)””)
Create Cookie Function with Vanilla JS
Easily create cookies with vanilla javascript. function createCookie(name, value, days) { if (days) { var date = new Date(); date.setTime(date.getTime() […]
Ajax Syncro
Ajax is asynchronous by definition, but sometimes you have to wait for the completion of a transaction. How? $.ajaxSetup({ async: […]
Open Facebook’s sharer.php similarly twitter intents popup
Make your facebook sharer.php social links open the same way as Twitter’s intent links. var socialpopup = function( url, title, […]
node-email-templates render hack
node-email-templates is a neat add-on for Nodemailer which allows you to store and render HTML/Text. The only problem is that […]
Close window
You can only close window created by yourself. So there is a trick for that: window.open(”, ‘_self’, ”) window.close()
Google’s WebFont loader .ready()
Google WebFont config allows you assign a active function that will be executed when all fonts are loaded. The problem […]
OnKeyDown – Enter
textboxId.onkeydown = function(e) { if (!e) { var e = window.event; } // Enter is pressed if (e.keyCode == 13) […]
Javascript Array length performance comparison
By caching the length of array’s length we can save up in some times quite a lot of miliseconds. This […]
How to switch test environment in Heroku
I am writing a code to Heroku for exclusively these days.I use the foreman when debugging in the local environment, […]
Lint-safe, ES5, strict-mode-safe access to the JavaScript global object
Need to access the global JavaScript object? Need to do so in an ES5/Strict Mode -safe way? Want to pass […]
Reload page on every visit, also when using the back-button
Do you want to reload your webpage one time, every time the page is visited, also when people are pressing […]
Extract the table-of-contents of a rendered markdown from the console
Extract the table-of-contents of a rendered markdown from the console Generate a markdown TOC (table of contents) with your dev […]
Easily Make Elements Draggable (IE8+, Multi-touch)
With Dragabilly from David DeSandro you can easily make elements draggble. Great thing: it supports IE8+ and multi-touch. Here’s the […]
Do you even code? [jQuery Object Creation]
jQuery is a brilliant framework that simplifies interaction with the DOM significantly, and one of the most common things you […]
Enable GZIP support on Heroku
So, I was working in a project with about 2MB of assets being loaded everytime without a good cache and […]
Firefox Addon Dev: nativeHandle
No need for the js-ctypes and hacks. For example on windows: The FindWindow trick to get the handle for chrome […]
Native equivalents of jQuery functions
If you are just targetting modern browsers and want more performance, it maybe a good idea to use native functions […]