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
| function xml(params) { | |
| var doc; | |
| function node(parent, params) { | |
| if (!doc) { | |
| doc = document.implementation.createDocument("", params.name, null); | |
| el = doc.documentElement; | |
| } else { | |
| var el = doc.createElement(params.name); | |
| parent.appendChild(el); | |
| } |
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
| var | |
| elements = document.querySelectorAll('.s-box'), | |
| docWidth, | |
| docHeight, | |
| docRatio; | |
| elements = Array.prototype.slice.call(elements); | |
| function onresize() { | |
| // ширина и высота документа |
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 | |
| $params = []; | |
| if ($_POST["firstname"]) { | |
| $params["firstname"] = $_POST["firstname"]; | |
| } | |
| if ($_POST["lastname"]) { | |
| $params["lastname"] = $_POST["lastname"]; | |
| } |
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
| $email = new PHPMailer(); | |
| $email->From = 'you@example.com'; | |
| $email->FromName = 'Your Name'; | |
| $email->Subject = 'Message Subject'; | |
| $email->Body = $bodytext; | |
| $email->AddAddress( 'destinationaddress@example.com' ); | |
| $file_to_attach = 'PATH_OF_YOUR_FILE_HERE'; | |
| $email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' ); |
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
| function promise(ex) { | |
| var e = {}, r = {} | |
| r.then = function (resolve, reject) { | |
| e.resolve = resolve || function() {}, | |
| e.reject = reject || function() {} | |
| } | |
| ex(function() { e.resolve.apply(this, arguments) }, | |
| function() { e.reject.apply(this, arguments) }) | |
| return r | |
| } |
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
| { | |
| "vehicles": [ | |
| { | |
| "id": 1, | |
| "regnum": "012345", | |
| "model": "Mersedes" | |
| }, | |
| { | |
| "id": 2, | |
| "regnum": "234567", |
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
| function doLuhnCheck(ccNumber) { | |
| if (/[^0-9-\s]+/.test(ccNumber)) { return false } | |
| var checksum = 0, | |
| digit = 0, | |
| isEven = false | |
| ccNumber = ccNumber.replace(/\D/g, "") | |
| for (var n = ccNumber.length - 1; n >= 0; n--) { |
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
| function save(data, name) { | |
| var a = document.createElement('a') | |
| a.download = name + '.json' | |
| a.href = 'data:application/json,' + encodeURIComponent(JSON.stringify(data)) | |
| a.dataset.downloadurl = ['application/json', a.download, a.href].join(':') | |
| document.body.appendChild(a) | |
| a.click() | |
| document.body.removeChild(a) | |
| } |
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
| /** | |
| * A Javascript test runner in 20 lines of code | |
| * From http://joakimbeng.eu01.aws.af.cm/a-javascript-test-runner-in-20-lines/ | |
| */ | |
| (function () { | |
| // The test queue: | |
| var tests = []; | |
| // Function to add tests: | |
| this.test = function test (name, cb) { |