Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / 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 / 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 / composing.software.md
Last active March 3, 2023 06:20
Eric Elliot: Composing Software Series

Eric Elliott: Composing Software

@frankfaustino
frankfaustino / destructuring.js
Created January 27, 2018 21:21 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@frankfaustino
frankfaustino / ContactForm.jsx
Last active March 28, 2018 16:19
React Router V4 Redirect after form submission
import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'
class ContactForm extends Component {
submitForm = (e) => {
e.preventDefault()
this.props.history.push('/thank-you')
}
render() {