Skip to content

Instantly share code, notes, and snippets.

$('#example').on( 'length.dt', function ( e, settings, len ) {
console.log( 'New page length: '+len );
} );
@venuduggireddy
venuduggireddy / nodejs image_browser
Last active April 30, 2023 04:08
Nodejs code to display images in a directory
fs = require('fs');
http = require('http');
url = require('url');
util = require('util');
function getFiles (dir, files_){
files_ = files_ || [];
var files = fs.readdirSync(dir);
for (var i in files){
var name = dir + '/' + files[i];
@venuduggireddy
venuduggireddy / move_zeros_to_left.py
Last active April 15, 2022 13:16
Move Zeros to the Left
'''Problem Statement
Given an integer array, move all elements that are 0 to the left while maintaining the order of other elements in the array.
The array has to be modified in-place.'''
def move_zeros_to_left(A):
for i, ele in enumerate(A, start=0):
if(ele == 0):
A.pop(i)
A.insert(0, 0)
@venuduggireddy
venuduggireddy / scrollIntoView.spec.ts
Created April 13, 2022 23:05
Angular unit test document.querySelector('') and scrollIntoView
//document.querySelector('#elId').scrollIntoView({ behavior: 'smooth'});
it('Sidenav Clicked navigate to route "Subawards', () => {
const mSpy = spyOn(component, 'clicked').and.callThrough();
let divElement = document.createElement('div');
divElement.setAttribute('id', "header");
spyOn(document, 'querySelector').and.returnValue(divElement);
component.clicked({ 'mode': 0, 'path': '#header' });
expect(mSpy).toHaveBeenCalled();