Skip to content

Instantly share code, notes, and snippets.

View code-reaper08's full-sized avatar
🔄
To iterate is human, to recurse divine.

Vishwa R code-reaper08

🔄
To iterate is human, to recurse divine.
View GitHub Profile
@code-reaper08
code-reaper08 / clean_code.md
Created September 30, 2022 18:20 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@code-reaper08
code-reaper08 / REPORT.md
Last active January 16, 2022 15:03
GSSoC'22 web-dev team meetings report

This gist holds all the meetings we've done, to collaborate on the official GSSoC'22 website.

Meet 1:

Date: 16-01-2022

Platform: google meet

Members: 3 (Mehek, Ruchika, Vishwa)

Discussed about:

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
@code-reaper08
code-reaper08 / Callback.js
Created August 10, 2021 18:08
Callback functions
function Readfile(filename, sizefinder) {
console.log('Reading file.....');
sizefinder();
}
function sizefinder() {
console.log('File size is 32mb');
}
Readfile('sampletxt', sizefinder);
@code-reaper08
code-reaper08 / example.js
Created August 10, 2021 17:42
undefined vs null
let a;
let b = null;
if (a === undefined) {
console.log("It is undefined, as it is not assigned any value.");
} else
console.log("It is not undefined");
if (b === null) {
console.log("The value is null, since it was the one assigned.")
} else
console.log("It is not null")
@code-reaper08
code-reaper08 / Sample.js
Created August 4, 2021 18:20
Demonstrating Time and space complexity.
// general swapping program...
function swap(a,b) {
let temp;
a = b;
b = temp;
}
// Function call...
swap(5,10)
@code-reaper08
code-reaper08 / Array.js
Created July 27, 2021 18:42
Final program
function Reverse(samparr, begin, end) {
while (begin < end) {
temp = samparr[begin];
samparr[begin] = samparr[end];
samparr[end] = temp;
begin = begin + 1;
end = end - 1;
}
}
@code-reaper08
code-reaper08 / Array.js
Last active July 27, 2021 18:41
Logger function
function Logger(samparr, n) {
for (i = 0; i < n; i++) {
console.log(samparr[i]);
}
}
@code-reaper08
code-reaper08 / Array.js
Created July 27, 2021 18:27
Rotate function
function Rotate(samparr, d, n) {
if (d == 0) {
return;
}
Reverse(samparr, 0, d - 1);
Reverse(samparr, d, n - 1);
Reverse(samparr, 0, n - 1);
}
@code-reaper08
code-reaper08 / Array.js
Created July 27, 2021 18:15
When d>n example
// let us have an array of n = 3 and d = 4
let samparr = [1,2,3];
// step 1 -> reverse d elements.
let samparr = ["out of bounds"]
// To resolve this we refactor d as d = d % n,
// so d becomes 1 and 1<n so we rotate the array with d as 1.
let samparr = [1,2,3];