Skip to content

Instantly share code, notes, and snippets.

export const updateFormFieldNameById = (id, value, formField) => {
/*
Find item in array by id and update the name with given value
*/
let _tempFormField = formField.map(r => {
if (id === r.id) {
return { ...r, name: value }
}
return r
})
import React, { useState, useEffect } from 'react'
import { connect } from 'react-redux'
import { Row, Col, Form, Input, Select, Button, Popover, Icon } from 'antd'
import withStyles from "isomorphic-style-loader/lib/withStyles"
import { updateStatePartnerFocusAreaInitiativeForm } from '../../../../actions/statePartner/updateActions'
import { getOtherOptionId } from '../../../../actions/statePartner/OtherOptionsHelper'
import { updateFormFieldNameById, updateFormFieldNameByIndex, addDeleteToRecordById, addDeleteToRecordByIndex,
updateFormFieldDescriptionById, updateFormFieldDescriptionByIndex } from '../helpers/FormHelpers'
import { AddMoreInitiativePopOver } from '../../../../components/PopOverHelpers'
/*
Time taken: 10 minutes
What I did.
1). I imported 'React'
2). I created a small user array with objects
3). I built out a Promise function for fetchUserProfile that resolves (finds an id match) or rejects (no id match found)
4). I added a fallback to React Suspense to display while data is fetching and component rendering is paused
The fallback is not showing, because data is in the file. If an API is used the fallback will show and not render the component
until data is available
*/
// App.js
function App() {
const [audio, setAudio] = useState({})
const dispatch = useDispatch()
const currentTrack = useSelector((state) => state.currentTrack)
const { isPlaying, episode: { episodeUrl, collectionName } } = currentTrack
document.title = collectionName && isPlaying ? collectionName : 'Podcast Player'
@avoajaugochukwu
avoajaugochukwu / css_for_react_podcast_player
Last active June 16, 2021 14:52
Css for react podcast player
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}
/*! tailwindcss v2.1.4 | MIT License | https://tailwindcss.com */
/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */html{-moz-tab-size:4;tab-size:4;line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:base
import os
import glob
import pandas as pd
if os.path.exists('output.xlsx'):
os.remove('output.xlsx')
all_excel_files = [i for i in glob.glob('*.xlsx')]
holder_list = list()
holder_list = list()
for i in range(len(all_excel_files)):
cfile = pd.read_excel(all_excel_files[i])
cfile.insert(0, "file_name", all_excel_files[i])
holder_list.append(cfile)
df = pd.concat(holder_list)
df.to_excel('output.xlsx', index=False)
pip install openpyxl
pip install xlrd
import os
import glob
import pandas as pd
if os.path.exists('output.xlsx'):
os.remove('output.xlsx')
all_excel_files = [i for i in glob.glob('*.xlsx')]
print(all_excel_files)