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
#include<stdio.h> | |
typedef struct process | |
{ | |
int id, at, bt, ct=0, rt=0, tat=0, wt=0,at1=0;/* at=arrival time,bt=burst time,ct=completed time,rt=respond time,tat= turn around time ,wt=waiting time*/ | |
int pri=0; | |
}pro; | |
void swap(pro &a, pro &b) | |
{ | |
pro temp = a; |
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
pragma solidity ^0.5.8; | |
contract MyContract { | |
string value; | |
// expose publicValue can be called outside of the contract | |
string public publicValue = "publicValue"; | |
// declare constant property | |
string public constant constantValue = "constantValue"; |
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
const isTruthy = param => !!param; | |
const isString = param => typeof (param) === 'string'; | |
const isNumeric = param => /^\d+$/.test(param); | |
const makeConditionalMethod = (method, required = false) => (...params) => { | |
const res = method(...params); | |
const valid = isTruthy(...params); | |
if (required) { | |
return valid && res; |
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
const convertObjectKeys = (obj, convertFn) => { | |
let result = {}; | |
for (const key in obj){ | |
result[convertFn(key)] = obj[key]; | |
} | |
return result; | |
} | |
const upperCase = str => str.toUpperCase(); |
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
const convertObjectKeys = (obj, convertFn) => { | |
let result = {}; | |
for (const key in obj){ | |
result[convertFn(key)] = obj[key]; | |
} | |
return result; | |
} | |
const upperCase = str => str.toUpperCase(); |
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 jwt_decode from 'jwt-decode'; | |
export const isExpiredToken = token => { | |
if (!token) return false; | |
var decoded_jwt = jwt_decode(token); | |
var current_time = new Date().getTime() / 1000; | |
return current_time > decoded_jwt.exp; | |
}; |
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
function remove_adjacent_duplicates(str) { | |
return str.replace(/(\w)\1+/g, ''); | |
} | |
remove_adjacent_duplicates("geeksforgeek") //gksforgk |
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
/** | |
Enforce required params for functions | |
@author Tauqeer Awan | |
*/ | |
// Define a function and throw an error from it | |
const isRequiredParameter = parameterName => { | |
throw new Error(`Missing parameter ${parameterName}`); | |
} |
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
for filename in **/__test__/*.test.tsx; do | |
mv $filename ${filename/.test/} | |
echo Updated $filename => ${filename/.test/} | |
done |
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 * as React from 'react'; | |
import { EnhanceCountDownPropsType, EnhanceCountDownStateType } from './types'; | |
class EnhanceCountDown extends React.PureComponent< | |
EnhanceCountDownPropsType, | |
EnhanceCountDownStateType | |
> { | |
countDownInterval?: number; | |
constructor(props: EnhanceCountDownPropsType) { |
OlderNewer