Monthly Archives: آبان 1392

Comment by Nasser Torabzade on Destructive young man shoots a cow in head and the old farmer says it’s OK

Yes, this is on of all-time-favorites. I posted this question almost desperately! never expected to actually find it! you REALLY made my day :) there is a weekly show on Iran's national TV that reviews best movies of the world and this movie was aired a few years ago, and really impressed me. I think I should have second look on Danish movies :D cheers from Iran!

Comment by Nasser Torabzade on Destructive young man shoots a cow in head and the old farmer says it’s OK

Yes, this is on of all-time-favorites. I posted this question almost desperately! never expected to actually find it! you REALLY made my day :) there is a weekly show on Iran's national TV that reviews best movies of the world and this movie was aired a few years ago, and really impressed me. I think I should have second look on Danish movies :D cheers from Iran!

Answer by Nasser Torabzade for Stop browser from auto scrolling when searching document (ctrl + f)

No, you can not disable that.

you only can scroll to nearest slide on every scroll event.

// fill lidesTopOffsets array with top offsets
// of your slides when document is ready
var slidesTopOffsets = [100, 200, 300, 400, 500];

var minDifferecne = 10000;

$( window ).scroll(function() {
    // find nearest slide
    for(var i=0; i < slidesTopOffsets.length; i++){
        if(Math.abs($(window).scrollTop() - slidesTopOffsets[i]) < minDifferecne)
            minDifferecne = slidesTopOffsets[i];
    }

    // scroll to nearest slide
    $(body).animate({
        scrollTop: minDifferecne
    }, 0);
});

hope that it helps.

Answer by Nasser Torabzade for Stop browser from auto scrolling when searching document (ctrl + f)

No, you can not disable that.

you only can scroll to nearest slide on every scroll event.

// fill lidesTopOffsets array with top offsets
// of your slides when document is ready
var slidesTopOffsets = [100, 200, 300, 400, 500];

var minDifferecne = 10000;

$( window ).scroll(function() {
    // find nearest slide
    for(var i=0; i < slidesTopOffsets.length; i++){
        if(Math.abs($(window).scrollTop() - slidesTopOffsets[i]) < minDifferecne)
            minDifferecne = slidesTopOffsets[i];
    }

    // scroll to nearest slide
    $(body).animate({
        scrollTop: minDifferecne
    }, 0);
});

hope that it helps.

Answer by Nasser Torabzade for Stop browser from auto scrolling when searching document (ctrl + f)

No, you can not disable that.

you only can scroll to nearest slide on every scroll event.

// fill lidesTopOffsets array with top offsets
// of your slides when document is ready
var slidesTopOffsets = [100, 200, 300, 400, 500];

var minDifferecne = 10000;

$( window ).scroll(function() {
    // find nearest slide
    for(var i=0; i < slidesTopOffsets.length; i++){
        if(Math.abs($(window).scrollTop() - slidesTopOffsets[i]) < minDifferecne)
            minDifferecne = slidesTopOffsets[i];
    }

    // scroll to nearest slide
    $(body).animate({
        scrollTop: minDifferecne
    }, 0);
});

hope that it helps.

[NasserTorabzade] مثل نوشیدن ِ یک فنجان چای، هر کاری یک دوران ِ کوتاه ِ طلایی داره. قبلش، میسوزوندتون؛ و بعدش، دیگه مزه‌ای نمیده.

ناصر تراب زاده @NasserTorabzade
مثل نوشیدن ِ یک فنجان چای، هر کاری یک دوران ِ کوتاه ِ طلایی داره. قبلش، میسوزوندتون؛ و بعدش، دیگه مزه‌ای نمیده.

[NasserTorabzade] مثل نوشیدن ِ یک فنجان چای، هر کاری یک دوران ِ کوتاه ِ طلایی داره. قبلش، میسوزوندتون؛ و بعدش، دیگه مزه‌ای نمیده.

ناصر تراب زاده @NasserTorabzade
مثل نوشیدن ِ یک فنجان چای، هر کاری یک دوران ِ کوتاه ِ طلایی داره. قبلش، میسوزوندتون؛ و بعدش، دیگه مزه‌ای نمیده.

Answer by Nasser Torabzade for how do I measure the load time of a large array?

you can always use console.time('timerName') and console.timeEnd('timerName') to set a timer and find out elapsed time between two points of your javascript code, then compare the results:

console.time('BigArray');
var arr1 = [];
for(var i=0; i<200000; i++){
    arr1.push('test');
}
console.timeEnd('BigArray');


console.time('SeveralArrays');
for(var i=0; i<200000; i++){
    var arr2 = ['test'];
}
console.timeEnd('SeveralArrays');

the output will be something like:

BigArray: 123ms
SeveralArrays: 456ms