Skip to content

Instantly share code, notes, and snippets.

View pedronauck's full-sized avatar
:electron:

Pedro Nauck pedronauck

:electron:
View GitHub Profile
@pedronauck
pedronauck / cloudSettings
Last active October 26, 2017 19:31
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-10-26T19:31:38.634Z","extensionVersion":"v2.8.3"}
@pedronauck
pedronauck / fuse.ts
Created October 14, 2017 21:16
Fusebox config example
import {
FuseBox,
BabelPlugin,
QuantumPlugin,
WebIndexPlugin,
TypeScriptHelpers,
Sparky,
} from 'fuse-box'
import * as path from 'path'
@pedronauck
pedronauck / base.ts
Created October 10, 2017 15:17
style variables
import { injectGlobal, css } from 'emotion'
import { lighten } from 'polished'
import * as colors from './colors'
import { looks, base, fontWeights } from './theme'
const Lato = 'Lato:100,300,400,700,900'
const Mukta = 'Mukta:200,300,400,500,600,700,800'
const Raleway = 'Raleway:100,200,300,400,500,600,700,800,900'
@pedronauck
pedronauck / pipe.ts
Created October 2, 2017 05:10
A simple pipe function implementation
const isFn = (val: any): boolean => typeof val === "function"
const isUndef = (val: any): boolean => typeof val === "undefined"
interface PipeFn {
(arg: any): (fn: (arg: any): any) => PipeFn | any
}
const pipe = (arg: any) => (fn: (arg: any): any) =>
isFn(fn) || !isUndef(fn) ? pipe(fn(arg)) : arg
@pedronauck
pedronauck / my-module.js
Created February 8, 2017 12:42
Todo Duck example
import { List, fromJS } from 'immutable';
import { createSelector } from 'reselect';
import { createAction, handleActions } from 'redux-actions';
import { takeLatest, takeEvery, take, fork, put, select } from 'redux-saga/effects';
import * as todos from 'ducks/entities/todos';
/**
* Constants
**/
import { combineReducers } from 'redux';
// Define the context to search files
const CONTEXT = require.context('./', true, /\.\/(.*)\/index.js?$/i);
// Populate a object with the reducer
const importReducer = (req) => (obj, path) => {
const [, componentName] = path.match(/\.\/(.*)\/index.js?$/i);
const reducer = {
[componentName]: req(path).default
@pedronauck
pedronauck / filter.js
Created December 18, 2016 20:53
Common array methods write in a recursive way
const filterResursive = (arr, fn, index = 0, result = []) => {
fn(arr[index], index) && result.push(arr[index]);
return index < arr.length ? filterResursive(arr, fn, index += 1, result) : result;
};
const filter = (arr, fn) => filterResursive(arr, fn);
module.exports = filter;
@pedronauck
pedronauck / parser.jsx
Created November 30, 2016 15:03
Propose to create a inline css parser to React Components
import { css } from 'css-tm';
const yellow = '#FC0';
const button = css`
background: ${yellow};
`;
const title = (size) => css`
font-size: ${size}px;
@pedronauck
pedronauck / conventions.md
Created August 27, 2015 04:44
Development work convetions

Convenções para Git

Principal Convenção: todos as mensagens referente a qualquer ação dentro do versionamento deverá ser feita em Inglês, seguindo as próximas convenções.

Razão: Inglês é a lingua internacional. Um dia você pode acabar desenvolvendo junto com a algum developer de outro país, escrever em uma linguagem universal ajudaria muito nessa situação.

Commits

  • Mensagens de commit devem ser escritos sempre no imperativa, nunca usar uma mensagem escrita no passado ou no presente.
  • Devem ser escrito apenas com lowercase.
@pedronauck
pedronauck / gist:4d00ea4a424322c7ac61
Created February 6, 2015 17:30
Webpack config example
'use strict';
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var settings = require('./config/settings');
var config = {
entry: {
main: path.join(settings.path.dev.app, 'main.jsx'),