Skip to content

Instantly share code, notes, and snippets.

View rakshitshah94's full-sized avatar
💭
If I can't, who else will ?

RAKSHIT SHAH rakshitshah94

💭
If I can't, who else will ?
View GitHub Profile
@rakshitshah94
rakshitshah94 / ArrayList.java
Last active February 25, 2018 14:49
ArrayList is a part of collection framework and is present in java.util package. It provides us dynamic arrays in Java. Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed.
import java.util.List;
import java.util.ArrayList;
/*
* ArrayList is a part of collection framework and is present in java.util package.
* It provides us dynamic arrays in Java.
* Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed.
*/
public class ArrayListExample {
public static void main(String[] args) {
@rakshitshah94
rakshitshah94 / LinkedListExample.java
Created February 25, 2018 14:47
ArrayList vs LinkedList live demo
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/*
*In Java, LinkedList class implements the list interface.
This class consists of the following methods :
1. boolean add(Object element) : It appends the element to the end of the list.
2. void add(int index, Object element): It inserts the element at the positionindexin the list.
3. void addFirst(Object element) : It inserts the element at the beginning of the list.
@rakshitshah94
rakshitshah94 / RemoveAllLineBreaks.js
Created October 27, 2018 20:32
Remove line breaks using javascript (Regex)
var str = "Hello,\nMy name is, Bob!\n";
str.replace(/(\r\n|\n|\r)/gm,"");
@rakshitshah94
rakshitshah94 / Simple way to connect Amazon Web Service EC2 instance with domain name.html
Created October 28, 2018 14:17
Simple way to connect Amazon Web Service EC2 instance with domain name
Within these normal 2 steps you will be able to connect your domain name with your EC2 instance and will be accessible publicly/Globally.
1. Allocate the elastic ip
2. Connect it with your Domain name using DNS manager of your registrar.
Let me explain more.
#1. Allocate an elastic IP for the EC2 instance you are integrating.
- Login with AWS, Find EC2 in AWS management console, go to Instance page.
- Find Elastic IPs page and click on "Allocate new address".
- After that, Click on Allocation button. Once it will be allocated, you need to bind it with your Instance, otherwise you may charge some amount.
- Go to Instances screen, Right-click on the row of the newly created elastic IP, and click on Associate address.
@rakshitshah94
rakshitshah94 / *.component.ts
Last active April 18, 2023 06:09
Refresh angular component without reload or navigation on another component
If you are working with angular and when you need to refresh component without navigation on another component or instead of using window.location.reload() or location.reload(), you can follow below code in your project:
<code>mySubscription: any;<code>
Adding following code snippet to the required component’s constructor will work.
this.router.routeReuseStrategy.shouldReuseRoute = function () {
return false;
};
import { Inject, Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Rx';
@Injectable()
export class AppConfig {
private config: Object = null;
private environment: Object = null;