Skip to content

Instantly share code, notes, and snippets.

View Rolando-Barbella's full-sized avatar
🏄
Surfing

Rolando Rolando-Barbella

🏄
Surfing
View GitHub Profile
@rocbear
rocbear / MixinExample.js
Last active April 8, 2023 09:26
React Native Stylesheet mixins
'use strict'
import React, {
Component,
StyleSheet,
View,
Text
} from 'react-native'
import { padding } from './styles/mixins'
export default class MixinExample extends Component {
@gaearon
gaearon / quiz.md
Last active January 11, 2024 16:56

A top-level App component returns <Button /> from its render() method.

  1. What is the relationship between <Button /> and this in that Button’s render()?

  2. Does rendering <Button><Icon /></Button> guarantee that an Icon mounts?

  3. Can the App change anything in the Button output? What and how?


@ljharb
ljharb / array_iteration_thoughts.md
Last active May 22, 2024 09:22
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

const duplicates = filesAndHashes.filter((file1, index1, array) => {
return array.some(
(file2, index2) => index1 !== index2 && file1.hash === file2.hash,
)
})
const groups = duplicates.reduce((groups, {filepath, hash}) => {
groups[hash] = groups[hash] || []
groups[hash].push(filepath)
return groups

What Hiring Should Look Like

This is definitely not the first time I've written about this topic, but I haven't written formally about it in quite awhile. So I want to revisit why I think technical-position interviewing is so poorly designed, and lay out what I think would be a better process.

I'm just one guy, with a bunch of strong opinions and a bunch of flaws. So take these suggestions with a grain of salt. I'm sure there's a lot of talented, passionate folks with other thoughts, and some are probably a lot more interesting and useful than my own.

But at the same time, I hope you'll set aside the assumptions and status quo of how interviewing is always done. Just because you were hired a certain way, and even if you liked it, doesn't mean that it's a good interview process to repeat.

If you're happy with the way technical interviewing currently works at your company, fine. Just stop, don't read any further. I'm not going to spend any effort trying to convince you otherwise.

@dabit3
dabit3 / storage.js
Created February 17, 2021 19:31
Example uploading / downloading files with S3, Amplify, & React
import { useState, useEffect } from 'react'
import { Storage } from 'aws-amplify'
function App() {
const [images, setImages] = useState([])
useEffect(() => {
fetchImages()
}, [])
async function fetchImages() {
let imageKeys = await Storage.list('')