Skip to content

Instantly share code, notes, and snippets.

View saaage's full-sized avatar

Stefan Age saaage

View GitHub Profile
import get from 'lodash.get'
import isEqual from 'lodash.isequal'
import v from 'voca'
export const titleCase = s => v.titleCase(s, ["'", /[A-Z]/])
export const isArray = val => Array.isArray(val)
// returns collection that is unique on the provided key
// eg: uniqueOn([{ id: 1, name: "stefan"}, { id: 1, name: "john" }], "id") => [{ id: 1, name "stefan"}]
import React, { useState, useEffect, useRef } from 'react'
import get from 'lodash.get'
import { array, bool, func } from 'prop-types'
import Autocomplete from '@material-ui/lab/Autocomplete'
import Button from '@material-ui/core/Button'
import FormGroup from '@material-ui/core/FormGroup'
import FormLabel from '@material-ui/core/FormLabel'
import FormHelperText from '@material-ui/core/FormHelperText'
import TextField from '@material-ui/core/TextField'
import { contains, compareUsingKey, isEmpty } from 'utils'
@saaage
saaage / App.js
Last active December 7, 2017 02:44
Conditional Routes
import React, { Component } from 'react'
import { Switch, Route } from 'react-router-dom'
import PrivateRoute from 'components/PrivateRoute'
import Login from 'components/Login'
class App extends Component {
state = {}
@saaage
saaage / CompX.js
Last active December 5, 2017 00:17
GN-React
import PropTypes from 'prop-types'
class CompX extends Component {
const { estimatedHours } = this.props
handleClick = (e) => {
e.preventDefault()
if (this.actualHours.value === estimatedHours) {
console.log('estimated hours matches actual hours :)')
}
// API that allows user to perform decryption actions on a given text
import _ from 'lodash'
import plain from './plain.txt'
export default class CipherDecrypter {
constructor(encrypted = "") {
this.base = plain.toUpperCase()
this.encrypted = encrypted
this.quadgramStats = this.getQuadgramStats()
}