You can post a json file with curl like so:
curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION
so for example:
| function declOfNum(number, titles) { | |
| cases = [2, 0, 1, 1, 1, 2]; | |
| return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
| } | |
| use: | |
| declOfNum(count, ['найдена', 'найдено', 'найдены']); | 
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" | 
| //following two rotation functions are updated versions of code from: https://github.com/mrdoob/three.js/issues/1219 | |
| //updated to work in latest versions (r52 tested) of THREE.js | |
| // Rotate an object around an axis in object space | |
| var rotationMatrix | |
| function rotateAroundObjectAxis( object, axis, radians ) { | |
| rotationMatrix = new THREE.Matrix4(); | |
| rotationMatrix.makeRotationAxis( axis.normalize(), radians ); | |
| object.matrix.multiplySelf( rotationMatrix ); // post-multiply | |
| object.rotation.setEulerFromRotationMatrix(object.matrix, object.order); | 
| if (!document.querySelectorAll) { | |
| document.querySelectorAll = function (selectors) { | |
| var style = document.createElement('style'), elements = [], element; | |
| document.documentElement.firstChild.appendChild(style); | |
| document._qsa = []; | |
| style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; | |
| window.scrollBy(0, 0); | |
| style.parentNode.removeChild(style); | 
| /* | |
| * Save a text file locally with a filename by triggering a download | |
| */ | |
| var text = "hello world", | |
| blob = new Blob([text], { type: 'text/plain' }), | |
| anchor = document.createElement('a'); | |
| anchor.download = "hello.txt"; | |
| anchor.href = (window.webkitURL || window.URL).createObjectURL(blob); | 
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
| <?php | |
| /** | |
| * Simple method to use the API from https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/ | |
| * Written by Jim Westergren and released to public domain | |
| * @return int count | |
| */ | |
| function checkPawnedPasswords(string $password) : int | |
| { | |
| $sha1 = strtoupper(sha1($password)); | |
| $data = file_get_contents('https://api.pwnedpasswords.com/range/'.substr($sha1, 0, 5)); |