Skip to content

Instantly share code, notes, and snippets.

@ashish1729
ashish1729 / cses_complete_removal.js
Created June 17, 2025 01:32
CSES script to remove completed tasks
$$(".task-score.icon.full").forEach(x => {
x.closest('.task').remove()
})
/*
// Sample code to perform I/O:
process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";
process.stdin.on("data", function (input) {
stdin_input += input; // Reading input from STDIN
});
function perm(n, m) {
m = m || n;
// console.log('calling', n, m);
var res = [];
if(n == 1) {
for( var i = 0 ; i < m ;i++) {
res.push([i]);
}
@ashish1729
ashish1729 / frameRate.js
Created November 25, 2017 13:10
frame rate limited animation request frame
var stop = false;
var frameCount = 0;
var $results = $("#results");
var fps, fpsInterval, startTime, now, then, elapsed;
startAnimating(10);
function startAnimating(fps) {
fpsInterval = 1000 / fps;
then = Date.now();
@ashish1729
ashish1729 / what-forces-layout.md
Created January 7, 2017 12:19 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()