Test-driven development

Test-driven development (TDD) is an AGILE methodology that flips the development lifecycle by ensuring that tests are written first, before the code is implemented, and that tests drive the development (and are not just used as a validation tool). The tenets of TDD are simple: Code is written only when there is a failing test ... Read more

Джеймс Роджерс - Массачусетский эксперимент

В 1965 году Джеймс Роджерс был приговорен к казни за так называемый “массачусетский эксперимент”, однако за два дня до казни будучи в камере он покончил с собой, отравившись цианидом калия, ампулу которого принес ему кто-то из его пациентов. Недавно “Массачусетский университет психологии и невропаталогии”, в котором работал доктор Роджерс, официально заявил, что этот эксперимент имеет ... Read more

Security-protection

Protection from login, register and reset-password brute-force attacks. Why humans should prove that they are humans by filling captchas? Lets bots prove that they are not bots with adding javascript to their user-agents! Important: delete username 'admin' if you have it on your site. More than 90% of brute-force attacks try to crack the 'admin' ... Read more

javascript DOM manipulation

DOM access is expensive; it’s the most common bottleneck when it comes to JavaScript performance. The bottom line is that DOM access should be reduced to minimum. This means: Avoiding DOM access in loops Assigning DOM references to local variables and working with the locals Using selectors API where available Caching the length when iterating ... Read more

javascript garden

Intro JavaScript Garden is a growing collection of documentation about the most quirky parts of the JavaScript programming language. It gives advice to avoid common mistakes and subtle bugs, as well as performance issues and bad practices, that non-expert JavaScript programmers may encounter on their endeavors into the depths of the language. JavaScript Garden does ... Read more

randomize (shuffle) an array

Given an integer n, write a function to return an array of size n, containing each of the numbers from 0 to n-1 in a random order. The numbers should not repeat and each number must be in array only once. Example: if n = 3, one possible array returned would be [2, 0, 1]. ... Read more