Skip to content

Instantly share code, notes, and snippets.

View akinncar's full-sized avatar

Akinn Rosa akinncar

View GitHub Profile
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@wojteklu
wojteklu / clean_code.md
Last active July 23, 2024 21:23
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@markerikson
markerikson / cheng-lou-spectrum-of-abstraction.md
Last active July 4, 2024 08:42
Cheng Lou - "On the Spectrum of Abstraction" summarized transcript (React Europe 2016)

Cheng Lou - On the Spectrum of Abstraction

Cheng Lou, a former member of the React team, gave an incredible talk at React Europe 2016 entitled "On the Spectrum of Abstraction". That talk is available for viewing here: https://www.youtube.com/watch?v=mVVNJKv9esE

It's only a half-hour, but it is mind-blowing. It's worth re-watching two or three times, to let the ideas sink in.

I just rewatched the talk for some research, and wrote down a summary that's semi-transcript-ish. I didn't see any other transcripts for this talk, other than the auto-generated closed captions, so I wanted to share for reference.

Summary

@sbsrnt
sbsrnt / Redux-saga module example.md
Last active December 14, 2022 13:36
redux-saga module example

Gist contains example files for redux-saga user(GET) module. The structure of redux for included files in this gist:

redux
├── user                          # Module name
│   ├── __tests__                 # Directory for redux module tests
│   │   ├── actions.test.js       # Action tests
│   │   └── saga.test.js          # Saga tests
│   ├── actions.js                # Module actions (f/e.: fetchUserRequest, fetchUserSuccess)
│   ├── reducer.js                # Module reducer
@derekstavis
derekstavis / FastList.tsx
Last active July 10, 2024 14:16 — forked from vishnevskiy/FastList.js
Discord's FastList, but in TypeScript
import { forEachObjIndexed } from "ramda";
import * as React from "react";
import {
Animated,
ScrollView,
View,
ViewStyle,
LayoutChangeEvent,
NativeScrollEvent,
} from "react-native";
@sibelius
sibelius / Environment.tsx
Last active October 7, 2022 23:07
Debug Relay Store on Chrome DevTools
const env = new Environment({
network,
store,
handlerProvider: RelayDefaultHandlerProvider,
log: isDev ? relayTransactionLogger : null,
});
if (isDev) {
window.relayEnvironment = env;
window.debugRelayStore = () =>
@danielbonifacio
danielbonifacio / js-before-frameworks.md
Last active September 15, 2022 16:29
Um resumo de JavaScript Moderno, antes dos frameworks (roteiro da série de vídeos)

Olá. Antes de iniciar, só para te contextualizar: escrevi esse arquivo na intenção de ser um roteiro para uma série de vídeos, por isso, em alguns casos, verão eu me referindo a este como se fosse um vídeo. No mais, espero que aprendam bastante, e compartilhe o conhecimento. Abs, Daniel Bonifacio.

JavaScript before any framework

É claro que todo desenvolvedor web já ouviu falar (ou ao menos deveria ter ouvido) sobre React, Vue ou Angular. Estas ferramentas são chamadas de frameworks, que são, basicamente, um conjunto de ferramentas para agilizar o desenvolvimento de aplicações front-end.

Escolher um framework para trabalho, às vezes, é uma decisão difícil. Empresas usam X, você gosta de Y, mas Z paga melhor, enfim... uma porra!

Mas existe algo em comum entre eles que você precisa saber antes de escolher um: JavaScript. Me chamo Daniel Bonifacio, sou Engenheiro de Software e nessa série eu vou te ensinar tudo que você precisa saber sobre JavaScript antes de entrar de cabeça em estudos de algum framewo

@sibelius
sibelius / FeatureFlag.tsx
Created May 6, 2020 12:33
Basic Feature Flag implementation using React.Context
import React, { useContext, useCallback } from 'react';
export const FeatureFlagContext = React.createContext<string[]>([]);
export const useFeatureFlag = () => {
const features = useContext<string[]>(FeatureFlagContext);
const hasFeature = useCallback(
(feature: string) => {
return features.includes(feature);
@sibelius
sibelius / useSWReg.tsx
Created May 26, 2020 11:57
use Service Worker Registration hook
import firebase from 'firebase/app';
import 'firebase/messaging';
import { useEffect, useRef } from 'react';
import config from '../config';
import firebaseConfig from './firebaseConfig';
import { PushTokenAddMutation } from './__generated__/PushTokenAddMutation.graphql';
import { PushTokenAdd, USER_PUSHENDPOINT_TYPE } from './PushTokenAddMutation';