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
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { | |
| // no easing, no acceleration | |
| linear: function (t) { return t }, | |
| // accelerating from zero velocity | |
| easeInQuad: function (t) { return t*t }, | |
| // decelerating to zero velocity |
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
| const CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
| const uniqid = () => { | |
| let now = Date.now(), chars = [], i = 8, id | |
| while (i--) { | |
| chars[i] = CHARS.charAt(now % 64) | |
| now = Math.floor(now / 64) | |
| } | |
| id = chars.join("") | |
| while (i++ < 8) { |
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 data = [ | |
| { | |
| title: "Одежда", | |
| left: 1, | |
| right: 22 | |
| }, | |
| { | |
| title: "Мужская", | |
| left: 2, | |
| right: 9 |
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 | |
| define('COCKPIT_ADMIN', 1); | |
| // set default url rewrite setting | |
| if (!isset($_SERVER['COCKPIT_URL_REWRITE'])) { | |
| $_SERVER['COCKPIT_URL_REWRITE'] = 'Off'; | |
| } | |
| // set default timezone |
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) { |
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
| 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
| { | |
| "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 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
| $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' ); |