Skip to content

Instantly share code, notes, and snippets.

@einarlove
einarlove / server-features.md
Created October 21, 2016 13:18
Earlybird server features

Hva vi gjør idag på EarlyBird server

  • healthcheck / pink
  • application insights
  • versjonsjekk mellom client og server
  • sentry error tracking
  • redirect for /personvern-og-cookies -> avinor
  • proxy
    • bilder
  • login
  • sikkerhetskontroll køtid
http://flights.tjenester.avinor.no/flights/departure/ham?fromDate=2016-09-18&toDate=2016-09-20
{
"lastUpdated": "2016-09-16T15:47:12.274Z",
"flightLegs": [
{
"id": "ew4192-ham-osl-20160919",
"flightIds": [
{
"flightId": "EW4192",
@einarlove
einarlove / Future.js
Last active July 26, 2016 14:32
What if you could pass a function that return multiple styles react-fela?
import { connect } from 'react-fela'
import React from 'react'
const App = ({ styles }) => (
<div>
<h1 className={styles.heading}>Sorry</h1>
<h2 className={styles.ingress}>All your base are belong to us</h2>
<p className={styles.paragraph}>We know it's not nice, but you don't need it anyway.</p>
</div>
)
import React from 'react'
import { Link } from 'react-router'
import { cashay as cashayClient } from '../client'
import { connect } from 'react-redux'
const FlightDetail = ({ request }) => {
const { data, isComplete } = request
if (!isComplete) {
return <div>Loading</div>
@einarlove
einarlove / normalized.js
Created June 8, 2016 00:15
normalized store with selectors for dummy requests
{
flightsById: {
'sk4011-osl-svg-2016-06-09': { … },
},
flightRequests: {
'sk4011-osl-svg-2016-06-09': {
startedAt: '2016-06-08T17:44:00Z',
completedAt: '2016-06-08T17:44:00Z',
error: null,
@einarlove
einarlove / data-structure-documentation.md
Last active April 27, 2016 08:53
EarlyBird content data structure documentation
@einarlove
einarlove / load-env.js
Created March 18, 2016 14:58
load local .env files with app.json as manifest
const path = require('path')
const fs = require('fs')
import attempt from 'lodash/attempt'
const app = require('./app.json')
const readDotEnv = filePath => attempt(
fs.readFileSync(filePath, 'utf-8').split('\n').filter(Boolean)
)
@einarlove
einarlove / fetch.js
Created February 20, 2016 14:23
Fetch decorator sketches
@connectData({
fetch: fetchMeals,
fromState: state => ({
meal: state.meals[state.profile.preferredMeal]
mealToOld: state.meals[state.profile.preferredMeal].created > new Date()
}),
})
@einarlove
einarlove / avinor-destiantions.txt
Created February 9, 2016 14:15
Destinasjoner via Avinor flyplasser rangert i lengde
3
KGS – Kos
4
ALF – Alta
BOO – Bodø
DOH – Doha
FAO – Faro
NCE – Nice
OSL – Oslo
@einarlove
einarlove / Delay.jsx
Created February 8, 2016 20:16
Delay for ReactMotion
import React, {Component} from 'react';
import {render} from 'react-dom';
import {Motion, spring} from 'react-motion';
// helper to delay a prop being passed by `period` ms
class Delay extends Component{
static defaultProps = {
period: 0
};
state = {