Skip to content

Instantly share code, notes, and snippets.

View juandc's full-sized avatar
🏠

Juan David Castro juandc

🏠
View GitHub Profile
@juandc
juandc / index.js
Created October 2, 2019 18:42 — forked from ryanflorence/index.js
const { createServer } = require('http');
createServer((req, res) => {
res.writeHead(200, {
Connection: 'Transfer-Encoding',
'Content-Type': 'text/html; charset=utf-8',
'Transfer-Encoding': 'chunked'
});
res.write(`

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
// NOTE: This is NOT how you'd normally use suspense.
// You'll either use react-cache or libraries that use react-cache.
// This is only for instructional purposes.
const cache = {}
function FetchPokemon({pokemonName}) {
const pokemon = cache[pokemonName]
if (!pokemon) {
const promise = fetchPokemon(pokemonName).then(
@juandc
juandc / .gitconfig
Created September 26, 2018 18:39 — forked from johnpolacek/.gitconfig
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
dmerged = "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
st = status
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App/App';
import './index.css';
const render = () => {
ReactDOM.render(<App />, document.getElementById('root'));
}
if (
@juandc
juandc / detectmotionurl.js
Created August 14, 2018 15:40 — forked from wagyu298/detectmotionurl.js
AWS Rekognition detectModerationLabels example for Node.js
#!/usr/bin/env node
const request = require('request');
const AWS = require('aws-sdk');
const rekognition = new AWS.Rekognition({
// Detect moderation labels is available on AWS region us-east-1, us-west-2 and eu-west-1
region: "us-west-2",
accessKeyId: "YOUR accessKeyId",
secretAccessKey: "YOUR secretAccessKey"
@juandc
juandc / gist:aba58f88d677ba8d495869e507f639a1
Created May 11, 2018 17:59 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@juandc
juandc / prepack-gentle-intro-1.md
Created May 8, 2018 20:53 — forked from gaearon/prepack-gentle-intro-1.md
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@juandc
juandc / .eslintrc.json
Last active March 15, 2022 02:22
ESLint + Prettier + Lint Staged config file
{
"parser": "babel-eslint",
"extends": ["airbnb", "prettier", "prettier/react"],
"plugins": ["prettier"],
"env": {
"browser": true,
"node": true
},
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],