Skip to content

Instantly share code, notes, and snippets.

View samcorcos's full-sized avatar
🕺

Sam Corcos samcorcos

🕺
View GitHub Profile
import React from 'react'
import { Context } from '../lib/context'
import { firebase, db } from '../lib/firebase'
import Data from '../components/Data'
export default class Home extends React.Component {
constructor (props) {
super(props)
this.state = {
@samcorcos
samcorcos / App.js
Last active December 15, 2019 00:46
import React from 'react'
import {SafeAreaView, View, Text} from 'react-native'
const App = props => {
return (
<SafeAreaView>
<View>
<Text>Home screen!</Text>
</View>
</SafeAreaView>
import React from 'react'
import {SafeAreaView, View, Text} from 'react-native'
import Amplify from 'aws-amplify'
import awsconfig from './aws-exports'
import {withAuthenticator} from 'aws-amplify-react-native'
Amplify.configure(awsconfig)
const App = props => {
return (
{
"data": {
"metrics": [
{
"time": 1577905826702,
"value": 62
},
{
"time": 1577905886702,
"value": 62
const generateCalendar = (today: Date) => {
const daysInMonth = getDaysInMonth(today)
const firstDay = new Date(today.getFullYear(), today.getMonth()).getDay()
// in order to calculate how many calendar weeks there are (starting on Sunday), we can take
// days in the month and add first day + 1 to include the first week offset. returns an array
// that looks something like this:
// [undefined, undefined, undefined, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
const daysWithOffset = new Array(daysInMonth + firstDay).fill(undefined).map((v, i) => {
if (i < firstDay) {