Yearly Archives: 2020


Latex: Start enumerate list with value zero (0) with no additional plugins

\begin{enumerate}
	\setcounter{enumi}{-1}
	\item Item 0
	\item Item 1
\end{enumerate}

The above snippet is a solution we used to start an enumeration list in Latex from the number zero (0). We wanted to avoid adding new packages and the above solution worked out for us.


ffmpeg: Cut out a part of a video

Following is a snippet we used to remove a few seconds from a video using ffmpeg

ffmpeg -i 'input.mkv' -filter_complex \
  "[0:v]trim=end=553,setpts=N/FRAME_RATE/TB[v0]; \
   [0:a]atrim=end=553,asetpts=N/SR/TB[a0]; \
   [0:v]trim=start=559,setpts=N/FRAME_RATE/TB[v1]; \
   [0:a]atrim=start=559,asetpts=N/SR/TB[a1]; \
   [v0][a0][v1][a1]concat=n=2:v=1:a=1[v][a]" \
  -map "[v]" -map "[a]" 'output.mkv'

Specifically, we removed the seconds 09:13 (second 553) to 09:19 (second 559).


Manually Start an Infinite Scroll on a browser without using a plugin 1

Recently, we needed to perform an infinite scroll on a website so that it would load all of its resources (both text and images). As the website was too long and it would take hours to manually scroll little by little, we used the Firefox console and JavaScript to perform the scroll without any additional plugins.

To do so we followed these steps: First we pressed the F12 button to enable the build-in console of Firefox.

Then, we typed allow pasting in the console to enable the ability to paste code directly into the console editor. Once we did that, we deleted the text allow pasting as it would create a problem once we run our code later on.

Following, we pasted the following code which both defines the function that performs the infinite scroll and the call that starts it.

//To avoid naming conflicts, give a non common names to the function and variable
var bytefreaksTimeout;

function bytefreaksScroll() {
    window.scrollBy(0,1);
    bytefreaksTimeout = setTimeout(bytefreaksScroll,10);
}

bytefreaksScroll();

As you will see in the following video, the scrolling was working flawlessly, once the scrolling reached the place we needed it to we used the following line in the console to stop the scrolling.

clearTimeout(bytefreaksTimeout);

Images, that are not visible initially, don’t show with Customizr Pro theme

Recently we were investigating an issue on a live website at which some images were not loading. After some testing we saw that only pictures that were visible while loading the page were being loaded as well. Checking the console we found the following JS error:

Uncaught TypeError: a.browser is undefined    jQuery 2
jquery.fancybox-1.3.4.min.js:1:205
NOK => browserDetect::addBrowserClassToBody => TypeError: t.browser is undefined tc-scripts.min.js:1:81903

We did not want to waste time on debugging this so we disabled the Load images on scroll option to get the site live asap. To do so, first we clicked on the Customize button on the admin bar:

Once the menu loaded, we clicked on the Advanced Options button:

From there, we clicked on Website Performances :

And got the following options

As seen in the image below, we disabled (among other changes) the option Load images on scroll

After pressing the Publish button, we reloaded the site, the JavaScript error was still there but the images were loading as expected.