Skip to content

Instantly share code, notes, and snippets.

View fresh5447's full-sized avatar

Douglas Walter fresh5447

View GitHub Profile
@fresh5447
fresh5447 / javascript.json
Created April 20, 2018 02:09
VS Code React Snippets
{
"react import": {
"prefix": "rim",
"body": "import ${1} from '${2}'${0}",
"description": "just a simple import"
},
"react class name": {
"prefix": "cname",
"body": "className={classes.${1}}",
"description": "jsx className shortcut"
{
"window.zoomLevel": 1,
"workbench.colorTheme": "Dracula",
"editor.tabSize": 2,
"workbench.startupEditor": "newUntitledFile",
"workbench.iconTheme": "vscode-icons",
"files.associations": {
"*.graphcool": "graphql",
},
"eslint.autoFixOnSave": true,
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="funky"
# ZSH_THEME="fino-time"
import { default as envalid, str, num } from 'envalid'
import winston from 'winston'
import { Papertrail } from 'winston-papertrail'
const LOG_LEVELS = [ 'debug', 'verbose', 'info', 'warn', 'error']
const env = envalid.cleanEnv(process.env, {
PAPERTRAIL_LOG_LEVEL: str({ desc: `Papertrail log level (${LOG_LEVELS})`, choices: LOG_LEVELS, devDefault: 'debug' }),
PAPERTRAIL_HOST: str({ desc: 'Papertrail hostname' }),
PAPERTRAIL_PORT: num({ desc: 'Papertrail port number'}),
@fresh5447
fresh5447 / App.js
Created December 5, 2017 23:05
declarative-react-decorator-transitions withState
import { compose, withHandlers, withState } from 'recompose';
const App = ({toggleBox, toggleBox2, showingBox, showingBox2}) =>
<div className="App">
<h1>Declarative Decorator Transitions</h1>
<button onClick={() => toggleBox((toggleBox) => !toggleBox)}>TOGGLE BOX</button>
<button onClick={() => toggleBox2((toggleBox2) => !toggleBox2)}>TOGGLE BOX 2</button>
<Box animationTrigger={showingBox} />
<Box2 animationTrigger={showingBox2} />
@fresh5447
fresh5447 / App.js
Created December 5, 2017 23:04
declarative-react-decorator-transitions withHandlers and withState
import { compose, withHandlers, withState } from 'recompose';
const App = ({toggleBox, toggleBox2, showingBox, showingBox2}) =>
<div className="App">
<h1>Declarative Decorator Transitions</h1>
<button onClick={toggleBox}>TOGGLE BOX</button>
<button onClick={toggleBox2}>TOGGLE BOX 2</button>
<Box animationTrigger={showingBox} />
<Box2 animationTrigger={showingBox2} />
</div>
@fresh5447
fresh5447 / Data.js
Created November 3, 2017 16:13
Tex Mex react challenge Data
export default {
company: [{title: "Lous Tex Mex"}],
address: {
street: '66212 El Paso Ave.',
suite: 'Suite 4B',
city: 'Austin',
state: 'TX',
zip: '73301'
},
priceTag: "https://cdn4.iconfinder.com/data/icons/banking-icons-3/100/1-512.png",
@fresh5447
fresh5447 / bball.js
Last active October 13, 2017 16:39
Homework - 4. Baseball Filter and Map
const baseballPlayers = [
{ name: "Barry Bonds", HR: 763, team: "San Francisco Giants", img: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Barry_Bonds_2006-05-08.jpg/440px-Barry_Bonds_2006-05-08.jpg" },
{ name: "Hank Aaron", HR: 755, team: "Atlanta Braves", img: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Hank_Aaron_-_Baseball_HOF_Induction_2013.jpg/500px-Hank_Aaron_-_Baseball_HOF_Induction_2013.jpg" },
{ name: "Babe Ruth", HR: 714, team: "New York Yankees", img: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/13/Babe_Ruth2.jpg/512px-Babe_Ruth2.jpg" },
{ name: "Alex Rodriguez", HR: 696, team: "New York Yankees" , img: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Alex_Rodriguez_2008-04-19.jpg/550px-Alex_Rodriguez_2008-04-19.jpg" },
{ name: "Carlton Fisk", HR: 376, team: "Boston Red Sox" , img: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Carlton_Fisk_-_Baseball_HOF_Induction_2013.jpg/440px-Carlton_Fisk_-_Baseball_HOF_Induction_2013.jpg"
@fresh5447
fresh5447 / data.js
Created July 28, 2017 17:01
Fake Data for Tex Mex React Exercise
export default {
title: "Lous Tex Mex",
address: {
street: '66212 El Paso Ave.',
suite: 'Suite 4B',
city: 'Austin',
state: 'TX',
zip: '73301'
},
phone: '1-223-782-9090',
@fresh5447
fresh5447 / introToState.js
Created July 26, 2017 19:05
Sample for users list.
import React from 'react';
import myData from './data/data'
// SMART / Container / has state
// DUMB / Presentational / return HTML
// this.setState({})
const UsersList = (props) => {