Skip to content

Instantly share code, notes, and snippets.

@frankfaustino
frankfaustino / Funky JSX Conditionals
Created January 25, 2018 01:17
Funky JSX Conditionals
// Good ol' ternary
<div>{condition ? <span /> : null}</div>
// AND
<div>{condition && <span />}</div>
// Multiple elements
<div>{condition ? [<span />, <span />] : null}</div>
@frankfaustino
frankfaustino / signIn.js
Created January 22, 2018 19:34
Sign In Page for LS Portfolio Project
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { FormControl, FormGroup } from 'react-bootstrap'
import { Link } from 'react-router-dom'
import { login } from '../Actions'
class SignIn extends Component {
constructor(props) {
super(props)
@frankfaustino
frankfaustino / signUp.js
Created January 22, 2018 19:30
Sign Up Page for LS Portfolio Project
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { FormControl, FormGroup } from 'react-bootstrap'
import { register } from '../Actions'
class SignUp extends Component {
constructor() {
super()
this.state = {
@frankfaustino
frankfaustino / nFactorial.js
Last active January 6, 2018 18:26
Factorial Calculator (Iterative vs Recursion)
// The for loop performs much faster
function nFactorial (num) {
let factorial = 1;
for (let i = 1; i <= num; i++) {
factorial *= i;
}
return factorial;
}
// Recursion is about 11× slower
@frankfaustino
frankfaustino / SearchResults.js
Created January 6, 2018 06:51
Search Function (part 2) from bookvote Project
import React, { Component } from 'react';
import axios from 'axios';
import url from '../../config';
import './SearchResult.css';
class SearchResult extends Component {
constructor(props) {
super(props);
this.state = {
upVote: this.props.results.VOTES.UP,
@frankfaustino
frankfaustino / Search.js
Last active January 22, 2018 19:24
Search Function from bookvote Project
import React, { Component } from 'react';
import SearchResult from './SearchResult.js';
import url from '../../config';
import axios from 'axios';
class Search extends Component {
constructor() {
super();
this.state = {
filter: 'SUBJECT',
@frankfaustino
frankfaustino / .hyper.js
Created September 21, 2017 19:13
Hyper Settings
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
visor: {
hotkey: 'Control+`',
position: 'right', // or left, right, bottom
width: 900, // Optional, defaults to half of viewable area for horizontal positions, 100% for vertical