Skip to content

Instantly share code, notes, and snippets.

View alexanderson1993's full-sized avatar
๐Ÿš€
Spaceshippin...

Alex Anderson alexanderson1993

๐Ÿš€
Spaceshippin...
View GitHub Profile

Keybase proof

I hereby claim:

  • I am alexanderson1993 on github.
  • I am alexanderson1993 (https://keybase.io/alexanderson1993) on keybase.
  • I have a public key whose fingerprint is 86FE FC46 60BA 8BD1 27E8 BB8C 6752 B79F 33C2 085F

To claim this, I am signing this object:

<Preview
simulatorId={this.props.simulator.id}
tacticalMapId={this.state.tacticalMapId}
layers={selectedTactical.layers}
layerId={this.state.layerId}
selectObject={this.selectObject}
objectId={this.state.objectId}
updateObject={this.updateObject}
removeObject={this.removeObject}
updatePath={this.updatePath}
@alexanderson1993
alexanderson1993 / Development Breakdown
Created May 10, 2019 21:31
WakaTime Development Breakdown
Hi
@alexanderson1993
alexanderson1993 / useCounter.js
Created July 20, 2019 14:30
A hook that increments a value every 1 second.
import React from 'react'
export default function useCounter(initialCount) {
const [time, setTime] = React.useState(initialCount);
// The timer might not be exactly 1000 ms, so track the time
// between intervals manually
const lastTimeRef = React.useRef(Date.now())
// This effect resets the timer to the initial count when it changes.
React.useEffect(() => {
// animationValue is a number from 0 to 1, generated by a tweener
// In this case, I'm using a useAnimation hook.
function calculateAnimationValue(animationValue, arcLength, arcStart) {
// Figure out where the animation starts
const animationStart = arcStart / 360;
// If our arc starts after where the animation currently is, return 0
// This renders an invisible arc.
if (animationValue < animationStart) {
return 0;
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")(process.env.STRIPE_KEY_SECRET);
exports.handler = (event, context, callback) => {
//console.log('Received event:', JSON.stringify(event, null, 2));
const done = (err, res) =>
callback(null, {
statusCode: err ? "400" : "200",
@alexanderson1993
alexanderson1993 / machine.js
Last active April 23, 2020 23:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import i18next from "i18next";
import {initReactI18next} from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import codegen from "codegen.macro";
import debounce from "lodash.debounce";
i18next
.use(LanguageDetector)
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources: {},