- YUI3 Test does not support Data Providers for Parameterized Testing. You are welcome to use the extremely hacky solution that I came up with.
- Because checking for failures (errors/exceptions) must be defined as a separate hash by name, you end up with a lot of duplication and potential for errors if you forget to rename the item in the "error" hash after renaming the test method.
- Because checking for failures (errors/exceptions) must be defined as a separate hash by name, you lose the ability to dynamically check for errors/exceptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| // -------------------------------------------------------------------- | |
| // JSHint Configuration, Strict Edition | |
| // -------------------------------------------------------------------- | |
| // | |
| // This is a options template for [JSHint][1], using [JSHint example][2] | |
| // and [Ory Band's example][3] as basis and setting config values to | |
| // be most strict: | |
| // | |
| // * set all enforcing options to true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Coders, if your goal is to align foo and bar, using a <tab> character is | |
| // incorrect. If your goal, however, is to create an additional level of | |
| // indentation, then go you. Either way, with a tab size other than 4, this | |
| // looks like shit. | |
| var foo = 1, | |
| bar = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Obtain the project (assumes you've forked it) | |
| % cd ~/projects | |
| % git clone [email protected]:wilmoore/sinatra.git && cd sinatra | |
| % bundle install | |
| # Run Tests | |
| % bundle exec rake test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <title>Test Console</title> | |
| <body class="yui3-skin-sam"> | |
| <div id="test-console"></div> | |
| <script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js"></script> | |
| <script src="tests.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed. | |
| The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol. | |
| I am a 59 year old programmer who was brought up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // assume these preferences came from a database as-is | |
| $userTimezonePreference = 'America/Denver'; | |
| $userStoredDateTime = '2012-04-02 00:15:40'; | |
| $dateTime = new DateTime($userStoredDateTime, new DateTimeZone($userTimezonePreference)); | |
| echo 'ORIG: ', $dateTime->format(DateTime::RFC2822), PHP_EOL; | |
| $dateTime->setTimezone(new DateTimeZone('UTC')); | |
| echo 'USER: ', $dateTime->format(DateTime::RFC2822), PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // breaks on 71st character -- breaking on 7x characters seems unreasonable | |
| public function setAuthSubPrivateKeyFile($file, $passphrase = null, | |
| $useIncludePath = false) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function filter_params(array $params = [], array $whitelist = []) { | |
| return array_map('trim', array_intersect_key($params, array_flip($whitelist))); | |
| } | |
| $params = ['is_admin' => 1, 'name' => ' Bob', 'surname' => 'Smith ']; | |
| $whitelist = ['name', 'surname']; | |
| // these are your whitelisted parameters (please don't forget to filter/validate before persisting) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SEE: http://demos.flesler.com/jquery/scrollTo/ |