var x = 5.0364342423;
parseFloat(x.toFixed(2));
//VS
Math.round(x*100)/100; // 97% faster
This file contains 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 getReadableFileSizeString = function(fileSizeInBytes) { | |
var i = -1; | |
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; | |
do { | |
fileSizeInBytes = fileSizeInBytes / 1024; | |
i++; | |
} while (fileSizeInBytes > 1024); | |
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; | |
}; |
This file contains 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
#!/bin/bash | |
rsync -auhiP -e 'ssh -p {sshPort}' /path/to/app/myApp.tar.gz user@host:/home/meteoruser/ |
This file contains 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
dv1 | dv2 | of1 | of2 | of3 | |
---|---|---|---|---|---|
3.95E+000 | 1.63E+000 | 0.44242 | 0.0055127 | 0.0666262 | |
7.11E+000 | 3.44E+000 | 0.860229 | 0.00615626 | 0.174343 | |
6.90E+000 | 1.78E+000 | 0.782869 | 0.0089705 | 0.122455 | |
7.79E+000 | 3.82E+000 | 0.960738 | 0.00650422 | 0.203037 | |
1.25E+000 | 3.28E+000 | 0.158067 | 0.00373114 | 0.031634 | |
5.63E+000 | 2.11E+000 | 0.643855 | 0.00648422 | 0.107407 | |
6.64E+000 | 2.33E+000 | 0.762737 | 0.00699037 | 0.132135 | |
3.96E+000 | 1.41E+000 | 0.444265 | 0.00597551 | 0.0638318 | |
6.38E+000 | 4.89E+000 | 0.864868 | 0.00535356 | 0.201884 |
This file contains 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 {Object} bound - Meteor.bindEnvironment aka Fiber wrapper | |
bound = Meteor.bindEnvironment (callback) -> return callback() | |
ServiceConfiguration.configurations.remove service: "instagram" | |
ServiceConfiguration.configurations.insert | |
service: "instagram" | |
clientId: "clientId" | |
requestPermissions: ['basic', 'likes', 'relationships', 'comments'] | |
scope: ['basic', 'likes', 'relationships', 'comments'] |
This file contains 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
// Better to execute this in Google Chrome | |
// 0. Go to vk.com on page where you would like to like all posts | |
// 1. Right click on any place of page | |
// 2. Inspect Element | |
// 3. In opened panel - choose "console" tab | |
// 4. Copy-paste code you se below and hit "Enter" key | |
(function(){ | |
var newscript = document.createElement('script'); | |
newscript.type = 'text/javascript'; | |
newscript.async = true; |
This file contains 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
user www-data; | |
worker_processes 2; #THIS VALUE SHOULD BE EQUAL TO PROCESS CORES QTY | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 2048; | |
multi_accept on; | |
} | |
http { |
JSPerf: Fastest If Callback
JSPerf: jQuery Selectors comparison