Skip to content

Instantly share code, notes, and snippets.

View fedir's full-sized avatar
🌤️
The sun is behind every cloud

Fedir RYKHTIK fedir

🌤️
The sun is behind every cloud
View GitHub Profile
@fedir
fedir / WeekNumber&FridayDate
Created August 26, 2015 10:17
WeekNumber & Las Week Working Day (Friday) in Google Spreadsheet
=7*C2+DATE(2015;1;1)-(8-WEEKDAY(date(O4;1;1)))
@fedir
fedir / getRemoteFileSize.js
Last active August 29, 2015 13:56
Get file size behind download link
var request;
request = $.ajax({
type: "HEAD",
url: $("#url").val(),
success: function () {
alert("Size is " + request.getResponseHeader("Content-Length"));
}
});
// Res.: http://stackoverflow.com/a/1440804/634275
@fedir
fedir / checkIe.js
Created February 5, 2014 16:19
Check IE9 IE10
if (document.addEventListener) {
alert("IE9 or greater");
}
if (window.requestAnimationFrame) {
alert("IE10 or greater");
}
@fedir
fedir / getTotalFileSize.js
Created February 6, 2014 09:18
Get total file size before upload with HTML5 File API and jQuery
var totalSize = 0;
$("input:file").each(function(){
if($(this)[0].files[0]) {
totalSize = totalSize + $(this)[0].files[0].size;
}
});
@fedir
fedir / 800widthResize.sh
Created February 10, 2014 13:10
Resize the images to be 800 pixels width. Height will be calculated automatically.
mogrify -resize 800x -format jpg *
@fedir
fedir / fr.sh
Created February 11, 2014 15:23 — forked from dadoonet/fr.sh
#!/bin/bash
ES='http://localhost:9200'
ESIDX='test3'
ESTYPE='test'
curl -XDELETE $ES/$ESIDX
curl -XPUT $ES/$ESIDX/ -d '{
"settings" : {
$$  The PID number of the process executing the shell. 
$?  Exit status variable. 
$0  The name of the command you used to call a program. 
$1  The first argument on the command line. 
$2  The second argument on the command line. 
$n  The nth argument on the command line. 
$*  All the arguments on the command line. 

$# The number of command line arguments.

alias yolo='git commit -am "Deal with it" && git push -f origin master'
@fedir
fedir / listImageSizesWithStatistics.sh
Last active August 29, 2015 13:57
Get sizes of files in teh folder with statistics of occurencies
identify -format "%wx%h\n" somefolder/* | sort | uniq -c
@fedir
fedir / listOrderDimensions.sh
Created April 1, 2014 16:50
List files with ordering by dimensions
identify -format "%wx%h %f\n" somefolder/* | sort -n