I have found PHP's PSRs to be a very good idea when it comes to having some sorts of standards for commonly performed tasks. Wheter it's logging, caching or performing HTTP calls.
What are PSRs? Here's a short description taken from Wikipedia:
| (ns isbn-verifier) | |
| (defn- digits | |
| "Splits ISBN 10 string into collection of digits" | |
| [col] | |
| (keep #(cond | |
| (Character/isDigit %) (Character/getNumericValue %) | |
| (= \X %) 10) | |
| col)) |
| // I have some testing framework in the scope | |
| // Questions below: | |
| // 1. Should the description be like it is here, in first `it`, or with `only` word added: | |
| // "should return Fizz when the number is divisible only by 3" | |
| // That would imply that the number is divisible by 3 only, which is technically not true, as it is divisible | |
| // by 1 as well, and some numbers, e.g. 6, 9, and so on, are divisible by themselves. | |
| it('should return Fizz when the number is divisible by 3', () => { | |
| // 2. Is that name enough, having `any` in it, to be complete in what numbers are producing `fizz`. | |
| // There is also a matter of adding `only` (similar to case #1) having `anyNumberDivisibleOnlyBy3`. |
I have found PHP's PSRs to be a very good idea when it comes to having some sorts of standards for commonly performed tasks. Wheter it's logging, caching or performing HTTP calls.
What are PSRs? Here's a short description taken from Wikipedia:
| describe('executing handlers', () => { | |
| context('for synchronous handlers', () => { | |
| it('should happen in sequence', async () => { | |
| const hook1 = { | |
| event: 'preEventName', | |
| handler: sinon.spy() | |
| }; | |
| const hook2 = { | |
| event: 'preEventName', | |
| handler: sinon.spy() |
| const allRequiredMethodsArePresent = requiredMethods.every(methodIsPresentIn(adaptersMethods)); |
| #!/usr/bin/env node | |
| console.log('Howdy!'); |
| #!/usr/bin/env bash | |
| echo "Howdy!" |
| echo "Howdy!" |
| (function() { | |
| var defineProperty = 'defineProperty' in Object, | |
| defineGetter = '__defineGetter__' in Object; | |
| // mini polyfill for defining getters | |
| Object.extend({ | |
| defineGetter: function(object, prop, fn) { | |
| if (defineProperty) { |
| <?php | |
| class Admin_Form_Delete extends Zend_Form | |
| { | |
| public function init() | |
| { | |
| $cancel = new Zend_Form_Element_Button('cancel'); | |
| $cancel->setLabel('Hold your horses, do not delete this fella!') | |
| ->setAttrib('onClick', |