I hereby claim:
- I am negarjf on github.
- I am negar (https://keybase.io/negar) on keybase.
- I have a public key ASARovy66SnbNXqFxtOo766-ahZYD6nUfJgcMOOBei3fxgo
To claim this, I am signing this object:
import React, {createContext, useReducer} from 'react'; | |
import initialState from "./initialState"; | |
import reducer from "./reducer"; | |
import useActions from "./useActions"; | |
export const UserContext = createContext(); | |
export const UserProvider = ({children}) => { | |
const value = {user: null}; |
/** | |
* Timer class for count-down and count-up | |
*/ | |
class Timer { | |
constructor (duration = 0, countDown = true, step = 1) { | |
this.duration = duration; | |
this.countDown = countDown; | |
this.step = step; | |
this.opr = countDown ? -1 : 1; | |
this.currentTime = this.freshCurrentTime; |
I hereby claim:
To claim this, I am signing this object:
class Stack{ | |
constructor(){ | |
this.top = null; | |
this.size = 0; | |
} | |
get isEmpty(){ | |
return this.top === null; | |
} |
class Queue { | |
constructor(){ | |
this.head = null; | |
this.tail = null; | |
this.size = 0; | |
} | |
get length(){ | |
return this.size; | |
} |
class DynamicArray{ | |
constructor(capacity){ | |
this.arr = []; | |
this.capacity = capacity; | |
this.length = 0; | |
for(let i = 0; i < capacity; i++){ | |
this.arr[i] = null; | |
} |
class circularQueue{ | |
constructor(max){ | |
this.array = []; | |
this.max= max; | |
this.length = 0; |
/** | |
* Find a Peak in an Array | |
* @param {number[]} nums | |
* @return {number} | |
*/ | |
var findPeakElement = function(nums) { | |
let l = nums.length - 1; | |
let half = Math.floor(l / 2); | |
let testArray = [10, 25, 25, 12, 22, 11, 90]; | |
console.log(sort(testArray)); | |
function sort(array){ | |
let length = array.length; | |
for(let i = 0; i < length; i++ ){ | |
# .htaccess config for local cross origin problem | |
Header always set Access-Control-Allow-Origin "*" | |
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" | |
Header always set Access-Control-Max-Age "1000" | |
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, cache-control" | |
RewriteEngine On | |
RewriteCond %{REQUEST_METHOD} OPTIONS |