…using LESS with Chrome’s DevTools. If you’ve already used Sass with Chrome’s DevTools, you’ll most likely already be familiar with the concepts introduced here.The Tl;drLESS has very recently added support for Source Maps, so this is new and exciting!DevTools mapping means you can view LESS styles for all your relevant…
…Using HTML5 validation is simpler in some cases, though it offers less flexibility. <head> <title>User Registration</title> <meta charset="UTF-8"> <style> input { width: 200px; } input:required:valid { border-color: mediumspringgreen; } input:required:invalid { border-color: lightcoral; } </style> </head> <body> <h3>Register new account</h3> <form onsubmit="return validatePasswords(this);"> Username: <br/> <input type="text" name="userName" required/> <br/>…
…using them. Instead, we load up the PanelManager. Down in the appReady block I’ve defined a new panel using the PanelManager API method createBottomPanel. Like the menu command this takes in a unique ID so I just reuse HELLOWORLD_EXECUTE. The second argument is a jQuery-wrapped block of HTML (and in…
…Using JavaScriptFor me, the main benefit of JSBin is the ability to test JavaScript quickly. I’m able to whip up quick and dirty code that I can test and adjust on-the-fly without the need to spin up a whole work environment. Sure, most browsers provide developer tools that offer a…
…using add() twice, we should be able to bring our Game into a state with two players. function testAfterAddingTwoPlayersToANewGameItIsPlayable() { $game = new Game(); $game->add('First Player'); $game->add('Second Player'); $this->assertTrue($game->isPlayable()); } By adding this second test method, we can ensure isPlayable() returns true, if conditions are met. But you may think…
…using this approach, your nested rows had to be a sum of the column's width that the nested columns lived within.In Foundation, nesting is done for you, you just have to insert one row inside of a column. No extra classes required. The other main difference is that every nest…
…using the variable on the next line. class RunnerFunctionsTest extends PHPUnit_Framework_TestCase { function testItCanFindCorrectAnswer() { $this->assertAnswersAreCorrectFor($this->getCorrectAnswerIDs()); } private function getCorrectAnswerIDs() { return array_diff(range(MIN_ANSWER_ID,MAX_ANSWER_ID), [WRONG_ANSWER_ID]); } } Now, what is really cool here is that we started with only two lines of code that was not that clear and it was…
…using in practice - is getting a kick in the pants with the new ECMAScript Internationalization API. Currently supported in Chrome 24, Chrome for Android, Firefox 29, IE 11, and Opera 15 (sadly no Safari support), the new Intl namespace provides a set of functionality to add internationalization to your…
…Using a BDD approach will force you to constantly consider the actual requirements and desired behavior of the software you're building.Two BDD tools have gained a lot of attention in the PHP community recently, Behat and phpspec. Behat helps you describe the external behavior of your application, using the readable Gherkin language.…
…using a library such as these, you get to think less about how your page renders in the browser and more about the features of your application. It's not like it's impossible to unit test with just plain JavaScript though. In that case, your life will be much easier if…