Skip to content

Instantly share code, notes, and snippets.

View ShubhamLaad's full-sized avatar
🙃
Think Different

Shubham Laad ShubhamLaad

🙃
Think Different
  • Pune
View GitHub Profile
@ShubhamLaad
ShubhamLaad / SEO
Created May 1, 2020 10:55
SEO meta tages
<!-- title tags -->
<title itemprop="name">{{ .Title }} | {{ .Site.Title }}</title>
<meta property="og:title" content="{{ .Title }} | {{ .Site.Title }}" />
<meta name="twitter:title" content="{{ .Title }} | {{ .Site.Title }}" />
<meta itemprop="name" content="{{ .Title }} | {{ .Site.Title }}" />
<meta name="application-name" content="{{ .Title }} | {{ .Site.Title }}" />
<meta property="og:site_name" content="{{ .Site.Params.sitename }}" />
<!-- description tags -->
<meta name="description" content="{{ .Description }} | {{ .Site.Params.description }}" />
<meta itemprop="description" content="{{ .Description }} | {{ .Site.Params.description }}" />
@ShubhamLaad
ShubhamLaad / React-Learning
Created January 13, 2020 07:36
React Learning
13-01-2020
- withRouter hoc to use for routing
- for active link use NavLink component
- <Switch> render on one component at time from <Router>
- <Ruter path="/post"> <Router path="/:id"> both renderred so use Switch for render only one, here post treaded as id
-
@ShubhamLaad
ShubhamLaad / array-delete-Q.js
Created December 10, 2019 12:59
array-delete-Q
var trees = ["pine","apple","oak","maple","cherry"];
delete trees[3];
console.log(trees.length);
@ShubhamLaad
ShubhamLaad / question1.js
Created November 30, 2019 04:35
What is the content of numbers array:
const length = 4;
const numbers = [];
for (var i = 0; i < length; i++);{
numbers.push(i + 1);
}
numbers; // => ???
@ShubhamLaad
ShubhamLaad / neste array-question.js
Last active November 29, 2019 17:54
Nested array question
const b = {
a: [1],
b: {
a: [2],
b: {
c: [3],
d: [4]
}
},
c:'2',
@ShubhamLaad
ShubhamLaad / .js
Created November 21, 2019 06:23
Scope problem
const arr = [10, 12, 15, 21];
for (var i = 0; i < arr.length; i++) {
setTimeout(function() {
console.log(`The value ${arr[i]} is at index: ${i}`);
}, (i+1) * 1000);
}
@ShubhamLaad
ShubhamLaad / .js
Created November 21, 2019 06:22
Hosting
{ /* Original code */
 console.log(i); 
 var i = 10
 console.log(i); // 10
}
{ /* Compilation phase */
 var i;
 console.log(i);
 i = 10
 console.log(i); // 10
@ShubhamLaad
ShubhamLaad / .js
Created November 21, 2019 06:22
Scope
function outer() {
let a = 1;
function inner() {
let b = 2;
function innermost() {
let c = 3;
console.log(a, b, c); // 1 2 3
}
innermost();
console.log(a, b); // 1 2 — 'c' is not defined
@ShubhamLaad
ShubhamLaad / .js
Created November 21, 2019 06:12
String & Number coercion
1 + "2" = "12"
"" + 1 + 0 = "10"
"" - 1 + 0 = -1
"-9\n" + 5 = "-9\n5"
"-9\n" - 5 = -14
"2" * "3" = 6
4 + 5 + "px" = "9px"
"$" + 4 + 5 = "$45"
"4" - 2 = 2
"4px" - 2 = NaN
@ShubhamLaad
ShubhamLaad / epic.ts
Created November 12, 2019 11:28 — forked from swapnil-webonise/epic.ts
Actions with redux-observable
import { ofType } from 'redux-observable';
import { map, switchMap, takeUntil } from 'rxjs/operators';
import { Actions } from '../constants/action-constant';
import { ajax } from 'rxjs/ajax';
import { fetchNextRaceFulfill, onRaceListSuccess } from '../actions/racing-action';
import apiConstant from '../constants/api-constant';
import { Race, RaceData } from '../types/racing';
export const fetchNextToRaceEpic = (action$: any) => action$.pipe(
ofType(Actions.FETCH_NEXT_RACE),