Skip to content

Instantly share code, notes, and snippets.

View srsandy's full-sized avatar
👨‍💻
Learning everyday.

Sandeep「 Flame 」 srsandy

👨‍💻
Learning everyday.
  • Delhi IND
View GitHub Profile
@srsandy
srsandy / prototype.md
Last active June 19, 2018 14:39
PROTOTYPE in JAVASCRIPT

PROTOTYPE IN JS. 😄

By default every function has a property name as prototype which is EMPTY (by default). We can add properties and methods to it.

Note: Every function is a contructor function in JS.

Let's say we have an function x and create an object x of x as x1 will inherite the prototype of x.

@srsandy
srsandy / eventEmitter.md
Last active May 23, 2018 13:16
Events in NodeJS

EventEmitter() in NodeJS 😄

EventEmitter is a class in NodeJS that helps to listen or fire events in your application. You can also keep track of events in you application.

Let's start with a simple eventEmitter example. First of all we need to add Event Object in our project

const events = require('events');
var eventEmitter = new events.EventEmitter();

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@srsandy
srsandy / JavaScript Notes.md
Last active July 10, 2020 12:58
JavaScript Notes

Javascript Notes

var, let & const

  • var provides functional scoping but not block scoping. var allow to log the variable without declaring it though it shows undefined.
  • let provides functional scoping as well as block scoping.
  • const provies functional scoping as well as block scoping but you cannot reassign value to a const type variable.

let and const will not allow you the log the variable without declaring it.

| Keyword | Scope | Hoisting|Can Be Reassigned|Can Be Redeclared

@srsandy
srsandy / ie67891011-css-hacks.txt
Created October 12, 2018 12:33 — forked from vidaaudrey/ie67891011-css-hacks.txt
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
@srsandy
srsandy / sharedMemoryArray.c
Last active January 22, 2024 00:52
Store an Array in shared memory c
// write.c
#include<stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
int main(int argc, char const *argv[]) {
int key = ftok(".", 34);
int *arr;
@srsandy
srsandy / BigNumberAdd.java
Last active March 19, 2020 13:07
Adding big numbers using Strings in java
public String Add(String input1, String input2) {
String ans = "";
int len1 = input1.length();
int len2 = input2.length();
if(len1 < len2){
String temp = input1;
input1 = input2;
input2 = temp;
}
@srsandy
srsandy / ImpJavaFunctions.md
Last active March 13, 2021 07:54
Java Methods for Interviews

Methods that can help you code quicker and better.

String/Array

toCharArray() //get char array of a String

charAt(int x) //get a char at the specific index

length() //string length
@srsandy
srsandy / AboutMe.png
Last active April 30, 2020 20:27
Sandeep Ranjan 👨🏻‍💻
AboutMe.png
@srsandy
srsandy / ArraySortingAlgorithmsComplexity.md
Created August 6, 2019 07:16
Array Sorting Algorithms Complexity

Array Sorting Algorithms Complexity

Name Best Average Worst Memory Stable Comments
Bubble sort n n2 n2 1 Yes
Insertion sort n n2 n2 1 Yes
Selection sort n2 n2 n2 1 No
Heap sort n log(n) n log(n) n log(n) 1 No
Merge sort n log(n) n log(n) n log(n) n Yes
Quick sort n log(n) n log(n) n2 log(n) No Quick