Skip to content

Instantly share code, notes, and snippets.

Avatar
:electron:

Pedro Nauck pedronauck

:electron:
View GitHub Profile
@pedronauck
pedronauck / git.md
Created May 14, 2013
Terminal commands
View git.md

Comandos Gerais

Clonar um Repositório

$ git clone 'nome-do-repositório'

Verificar status

$ git status
@pedronauck
pedronauck / useHotkeys.ts
Created Dec 11, 2018
usePopper and useHotkeys hooks
View useHotkeys.ts
import { useEffect } from 'react'
import hotkeys from 'hotkeys-js'
export const useHotkeys = (key: string, cb: () => any, inputs?: any[]) => {
useEffect(() => {
hotkeys(key, cb)
return () => hotkeys.unbind(key)
}, inputs)
}
@pedronauck
pedronauck / Header.tsx
Created Jul 11, 2020
Tailwind, PostCSS, Styled-JSX and NextJS
View Header.tsx
import React from 'react'
import { Link } from 'systems/Core/Link'
import css from 'styled-jsx/css'
export const Header = () => {
return (
<header className="Root">
<img src="/logo.svg" width={100} />
<div className="MainMenu">
<ul className="MenuList">
@pedronauck
pedronauck / Subscribe.tsx
Created Jul 11, 2020
Tailwind (with twin.macro), Emotion, NextJS and ChakraUI
View Subscribe.tsx
/** @jsx jsx */
import { jsx, css } from '@emotion/core'
import tw from 'twin.macro'
import { Button, Input } from 'systems/Core'
export const Subscribe: React.FC = () => {
return (
<div css={styles.Root}>
<h4>Subscribe to our newsletter</h4>
@pedronauck
pedronauck / README.md
Created May 14, 2013 — forked from zenorocha/README.md
Sample file for README.md
View README.md

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@pedronauck
pedronauck / model.js
Last active Apr 23, 2020
Model file for mongoose
View model.js
'use strict';
var mongoose = require('mongoose'),
timestamp = require('timestamp'),
Schema = mongoose.Schema,
ObjectId = Schema.Types.ObjectId;
var ModelSchema = new Schema({
name: { type: String }
});
View automatic-combine-reducers.js
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 / hackaton-floripajs.md
Last active Dec 5, 2019
Formato para Hackaton
View hackaton-floripajs.md

Hackaton FloripaJS

Informações

  • Local: A defindir
  • Horário: 08:00 até as 22:00
  • Inscrições pré definidas via Sympla, Eventic, etc

Regras

@pedronauck
pedronauck / controlAsyncFlow.js
Created Sep 7, 2014
Example using async library to avoid callback hell
View controlAsyncFlow.js
var async = require('async');
var Product = require('../model/Product');
var Category = require('../model/Category');
var Attribute = require('../model/Attributes');
// bad idea
exports.index = function() {
Product.find(function(err, products) {
Category.find(function(err, categories) {
Attribute.find(function(err, attributes) {
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
You can’t perform that action at this time.