This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.
npm install element.scrollintoviewifneeded-polyfill
Usage
| function expmod( base, exp, mod ){ | |
| if (exp === 0) return 1; | |
| if (exp % 2 === 0){ | |
| return Math.pow( expmod( base, (exp / 2), mod), 2) % mod; | |
| } | |
| else { | |
| return (base * expmod( base, (exp - 1), mod)) % mod; | |
| } | |
| } |
| #!/bin/sh | |
| set -e | |
| HOST=localhost | |
| DB=test-entd-products | |
| COL=asimproducts | |
| S3PATH="s3://mongodb-backups-test1-entd/$DB/$COL/" | |
| S3BACKUP=$S3PATH`date +"%Y%m%d_%H%M%S"`.dump.gz | |
| S3LATEST=$S3PATH"latest".dump.gz | |
| /usr/bin/aws s3 mb $S3PATH |
| /* | |
| fmod for Javascript, will work with any ECMA-262 implementation. | |
| If you need a precision higher than 8, please use another implementation of fmod. | |
| 1.05 % 0.05 | |
| => 0.04999999999999999 | |
| Math.fmod(1.05, 0.05) | |
| => 0 |
| var Base64 = { | |
| characters: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" , | |
| encode: function( string ) | |
| { | |
| var characters = Base64.characters; | |
| var result = ''; | |
| var i = 0; | |
| do { |