- Location
- pathname
- state
- search/query
- hash
- Path
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
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, { useRef } from "react"; | |
import "./FileInput.scss"; | |
import { greyTrash} from "assets/images/svg"; | |
interface InputProps { | |
id?: string; | |
type: string; | |
handleChange?: any; | |
disabled?: boolean; |
A Pen by oluwasusi david damilola on CodePen.
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
export const getUniqueItemsFromArray = (array=[]) => { | |
return Array.from(new Set(array)).length() | |
} |
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 bitStr(n, s): | |
if n == 1: return s | |
return [ digit + bits for digit in bitStr(1,s) for bits in bitStr(n- 1,s)] | |
print (bitStr(3,'abc')) |
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
export default function usePromise(api) { | |
const [state, dispatch] = useReducer( | |
(state, action) => { | |
switch (action.type) { | |
case 'LOADING': | |
return { ...state, loading: true } | |
case 'RESOLVED': | |
return { ...state, loading: false, response: action.response, error: null } | |
case 'ERROR': | |
return { ...state, loading: false, response: null, error: action.error } |
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 removeInstance = (array=[], val=null) => { | |
if(!Array.isArray(array)) return 0; | |
if(!val) return array.length; | |
let currIndex = array.indexOf(val); | |
while(currIndex !== -1){ | |
array.splice(currIndex, 1) | |
currIndex = array.indexOf(val); | |
} | |
return array.length | |
} |
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 getDiff = (date1, date2) => { | |
let diff = date1 - date2 | |
const result = (diff/60) | |
return result; | |
} | |
const parseToSeconds = (time)=> { | |
const hrsMins = time.split(':') | |
const secHrs = parseInt(hrsMins[0],10) * 60 * 60 | |
const secMins = parseInt(hrsMins[1],10) * 60 |
OlderNewer