Skip to content

Instantly share code, notes, and snippets.

View marekdano's full-sized avatar
😁
coding for 🚀

Marek Dano marekdano

😁
coding for 🚀
View GitHub Profile
@homam
homam / AWS_S3_File_Upload.js
Created January 27, 2014 10:08
How to upload files to AWS S3 with NodeJS SDK
var AWS = require('aws-sdk'),
fs = require('fs');
// For dev purposes only
AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' });
// Read in the file, convert it to base64, store to S3
fs.readFile('del.txt', function (err, data) {
if (err) { throw err; }

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@kentcdodds
kentcdodds / move-photos.js
Created January 11, 2020 00:01
Just a script I wrote to get my downloaded Google Photos into the right place.
const path = require('path')
const fs = require('fs')
const execSync = require('child_process').execSync
if (!process.argv[2] || !process.argv[3]) {
throw new Error('you did not pass the source and destination paths')
}
const searchPath = path.join(process.cwd(), process.argv[2])
const destination = path.join(process.cwd(), process.argv[3])
HTML
- Semantic HTML
- Event delegation
- Accessibility / ARIA
CSS
- Specificity
- Pseudo-elements
- Pseudo-selectors
- Combinators
@cassidoo
cassidoo / wizeline.js
Created May 22, 2020 00:28
Wizeline webinar on hooks
import React, { useState, useEffect, useReducer, useMemo } from 'react'
import ReactDOM from 'react-dom'
// let text = 'hellllooooo'
// I AM REACT
// let domTable = {}
// let element = Counter // state = 0
// commit(element, domTable)
// source: https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/
(function(){
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
@kentcdodds
kentcdodds / README.md
Last active March 30, 2024 11:39
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

@adrianhajdin
adrianhajdin / constants.js
Created August 26, 2022 11:46
Build and Deploy a Modern YouTube Clone Application in React JS with Material UI 5
import MusicNoteIcon from '@mui/icons-material/MusicNote';
import HomeIcon from '@mui/icons-material/Home';
import CodeIcon from '@mui/icons-material/Code';
import OndemandVideoIcon from '@mui/icons-material/OndemandVideo';
import SportsEsportsIcon from '@mui/icons-material/SportsEsports';
import LiveTvIcon from '@mui/icons-material/LiveTv';
import SchoolIcon from '@mui/icons-material/School';
import FaceRetouchingNaturalIcon from '@mui/icons-material/FaceRetouchingNatural';
import CheckroomIcon from '@mui/icons-material/Checkroom';
import GraphicEqIcon from '@mui/icons-material/GraphicEq';