Skip to content

Instantly share code, notes, and snippets.

View samcorcos's full-sized avatar

Sam Corcos samcorcos

View GitHub Profile
import firebase from 'firebase/app'
import 'firebase/firestore'
import 'firebase/auth'
import 'firebase/functions'
import 'firebase/storage'
const firebaseConfig = {
apiKey: "AIzaSyBKSk6fpE4XsscB-Id2QGDthUGVZlAVHtc",
authDomain: "react-firebase-next.firebaseapp.com",
databaseURL: "https://react-firebase-next.firebaseio.com",
import React from 'react'
import { firebase } from './firebase'
export const initialState = {
currentUser: {},
data: {}
}
export const Context = React.createContext(initialState)
@samcorcos
samcorcos / dfs.js
Created August 29, 2018 04:29
Depth-first Search Javascript
const tree = {
id: "1",
children: [
{id: "2", children: [
{id: "4", children: [
{id: "7", children: []}
]},
{id: "6", children: []},
]},
{id: "3", children: [
@samcorcos
samcorcos / iddfs.js
Last active August 28, 2018 21:53
Iterative Deepening Depth-first Search (DFS) Javascript
// Iterative deepening DFS
const tree = {
id: "1",
children: [
{id: "2", children: [
{id: "4", children: [
{id: "7", children: []}
]},
{id: "6", children: []},
import React from 'react'
import PropTypes from 'prop-types'
import Radium from 'radium'
import styles from './styles'
const Checkmark = () =>
<div style={{ width: '100%', height: 'auto', }}>
<svg viewBox="0 0 64 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
<title>Path 2</title>
<desc>Created with Sketch.</desc>
@samcorcos
samcorcos / california.js
Created April 22, 2017 00:20
California Cities Hash Map
const california = {
'acalanes-ridge':
{ name: 'Acalanes Ridge',
id: 'acalanes-ridge',
stateAbbr: 'CA',
state: 'California' },
acampo:
{ name: 'Acampo',
id: 'acampo',
stateAbbr: 'CA',
let containerId
module.exports.hello = (event, context, callback) => {
if (!containerId) containerId = context.awsRequestId
console.log(containerId)
callback(null, {
statusCode: 200,
body: JSON.stringify({
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import Camera from 'react-native-openalpr';
const styles = StyleSheet.create({
container: {
// Reducer.js
const initialState = {
user: {
email: null,
name: null,
},
myForm: { // define our form in advance
input1: null,
input2: null,
},
@samcorcos
samcorcos / local_control_native.jsx
Created February 24, 2017 01:07
React native local control
import React from 'react'
import { View, TextInput, } from 'react-native'
export class Form extends React.PureComponent {
constructor(props) {
super(props)
this.state = {
input1: null,
input2: null,
}