This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pyramid(num): | |
for i in range(1, num+1): | |
if i == num: | |
for j in reversed(range(1, num+1)): | |
print('*'*j) | |
else: | |
print('*'*i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"firstname": "Alen", | |
"lastname": "Thomas" | |
}, | |
{ | |
"firstname": "Alen", | |
"lastname": "Thomas" | |
},{ | |
"firstname": "Alen", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"Category": | |
[{"category":"auto-driver","display":"Vehicle No"}, | |
{"category":"shopkeeper", "display":"Shop Name"}, | |
{"category":"medical", "display": "Medical Store Name"}] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in js using for-loop | |
function swap(ary, indexes) { | |
var visited = []; | |
var newAry = Array(ary.length).fill(null); | |
for(let i=0; i<indexes.length; i++) { | |
newAry[indexes[i]] = 'X'; | |
visited.push(indexes[i]); | |
} | |
for(let i=0; i<newAry.length; i++) { | |
if(newAry[i] === null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id="demo"></div> | |
<button onclick="start();">Start</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/OktaAuthComponent.js | |
import React, { Component } from 'react'; | |
import { Redirect } from 'react-router-dom'; | |
import { withAuth } from '@okta/okta-react'; | |
export const OktaAuthComponent = withAuth(class Auth extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { authenticated: null }; | |
this.checkAuthentication = this.checkAuthentication.bind(this); | |
this.checkAuthentication(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { BrowserRouter, Route } from 'react-router-dom'; | |
import { Security, ImplicitCallback } from '@okta/okta-react'; | |
import { OktaAuthComponent, OktaLogout } from './OktaAuthComponent.js' | |
const config = { | |
issuer: 'https://*****.oktapreview.com/oauth2/default', // replace this with your okta dev url | |
redirect_uri: window.location.origin + '/implicit/callback', | |
client_id: '****' // replace this with your okta client_id | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/OktaAuthComponent.js | |
import React, { Component } from 'react'; | |
import { Redirect } from 'react-router-dom'; | |
import { withAuth } from '@okta/okta-react'; | |
export const OktaAuthComponent = withAuth(class Auth extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { authenticated: null }; | |
this.checkAuthentication = this.checkAuthentication.bind(this); | |
this.checkAuthentication(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { BrowserRouter, Route } from 'react-router-dom'; | |
import { Security, ImplicitCallback } from '@okta/okta-react'; | |
import { OktaAuthComponent, OktaLogout } from './OktaAuthComponent.js' | |
const config = { | |
issuer: 'https://*****.oktapreview.com/oauth2/default', // replace this with your okta dev url | |
redirect_uri: window.location.origin + '/implicit/callback', | |
client_id: '****' // replace this with your okta client_id | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let postObject = posts.reverse().reduce((acc, ele) => { | |
if(acc.s > 0) { | |
return {arr: [ele, ...acc.arr], rows: acc.rows, s: acc.s-1} | |
} else { | |
return {arr: [ele], rows: [acc.arr, ...acc.rows], s: 2}; | |
} | |
}, {arr: [], rows: [], s: 3}); | |
let rows = [[...postObject.arr], ...postObject.rows ]; |
OlderNewer