Skip to content

Instantly share code, notes, and snippets.


Anuradha Kumari anuk79

View GitHub Profile
View textOverflowEllipsis.css
.overflow-with-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 200px; /** width should be there for the traget or parent container */
  import moment from 'moment';
  const datesArr = ['2020-03-01', '2020-01-10', '2020-02-07'];
  const result  = datesArr.sort((d1, d2) => moment(d1) - moment(d2));

  console.log(result); // asc sort
View gist:e201d775725b6779e5e004b976835411
// helper function to get all focusable elements in the context provided in arguments
function getFocusable(context = 'document') {
let focusable = Array.from(context.querySelectorAll('button, [href], select, textarea, input:not([type="hidden"]), [tabindex]:not([tabindex="-1"])'));
return focusable;
// get the first focusable element within a context
export function getFirstFocusable(context = 'document') {
let focusable = getFocusable(context);
View commonKeyCodesToSupportAccessibility.js
document.addEventListener('keyup', (event) => {
switch (event.keyCode) {
// escape
case 27:
// code to exit current component
// enter || spacebar
case 13 || 32:
// submit or some action
anuk79 /
Created April 6, 2020 13:51 — forked from bvaughn/
How to use profiling in production mode for react-dom
View user_withourDisplayName.styled.js
// vendors
import styled from 'styled-components';
// components
import LoadingSpinner from '../../../components/loading-spinner/loading-spinner';
export const LoadingSpinnerStyled = styled(LoadingSpinner)`
margin: 20px;
View user.styled.js
import styled from 'styled-components';
// components
import LoadingSpinner from '../../../components/loading-spinner/loading-spinner';
export const LoadingSpinnerStyled = styled(LoadingSpinner)`
margin: 20px;
LoadingSpinnerStyled.displayName = 'LoadingSpinnerStyled';
View user.jsx
import {
} from './user.styled';
export class User extends Component {
render() {
const { fetching, userDetails, errorFlag } = this.props;
let content;
if(fetching) {
anuk79 /
Created March 30, 2020 10:33 — forked from tatianamac/
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Before I'll agree to a speaking event, I try to do as much research I can around the event to ensure it aligns with my ethos. I want to share this in case it's helpful to any other speakers.

👐 Speaking comes with immense privilege. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most marginalised and suppressed communities.

😫 I wish I didn't have to, but this is long because I provide a lot of explanations for those of you who never had to consider these things. And I will be honest, most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

1️⃣ All of these are based on my own ethos. I don't wish to or attempt to speak on behalf of all conference speake

anuk79 / flattenArray.js
Last active February 28, 2020 17:26
[JavaScript] Create a function to flatten a multi dimensional array with numbers, and remove any null/undefined value if present
View flattenArray.js
function flattenArray(arr, res) {
let result = [];
for(let index = 0; index < arr.length; index++) {
const currentValue = arr[index];
if(Array.isArray(currentValue)) {
result = [...result, ...(flattenArray(currentValue))];
// we can also use concat method to achieve the same result
// result = result.concat(flattenArray(currentValue));
} else {