Skip to content

Instantly share code, notes, and snippets.

View pekkis's full-sized avatar

Mikko Forsström pekkis

View GitHub Profile
@pekkis
pekkis / tussi.js
Created November 11, 2016 08:31
TUSSI
import personService from 'services/person';
import uuid from 'node-uuid';
const defaultState = {
persons: [],
};
export function getPersons() {
return {
type: 'PERSON_GET_PERSONS',
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import Button from './Button';
storiesOf('Button', module)
.add('Primary button', () => (
<Button
role="primary"
onClick={action('clixuti')}
>
import React from 'react';
import { Router } from 'react-router-dom';
import createBrowserHistory from 'history/createBrowserHistory';
const LOCATION_CHANGE = '@@router/LOCATION_CHANGE';
export const history = createBrowserHistory();
class ReduxRouter extends React.Component {
static propTypes = {
module.exports = {
plugins: {
precss: {},
autoprefixer: {
browsers: ['last 2 versions'],
},
},
};
import React from "react";
import personService from "../services/person";
import { Form, Field } from "react-final-form";
import { DateTime } from "luxon";
const required = value => (value ? undefined : "Required");
const mustBeDate = value => {
const dt = DateTime.fromISO(value);
return dt.invalid && "Must be a date";
};
@pekkis
pekkis / lus.js
Last active March 13, 2018 12:56
import schema from "./schema";
import { graphqlExpress, graphiqlExpress } from "apollo-server-express";
app.use(
"/graphql",
graphqlExpress(req => {
return {
schema
};
})
import React from "react";
import personService from "../services/person";
import { Form, Field } from "react-final-form";
import { DateTime } from "luxon";
const required = value => (value ? undefined : "Required");
const mustBeDate = value => {
const dt = DateTime.fromISO(value);
return dt.invalid && "Must be a date";
};
@pekkis
pekkis / gist:dc6507d0ebf115e9b289fc66024ea646
Created June 21, 2018 05:38
server/src/services/raw/person.js
// this one goes to the personService--createPerson
get age() {
const d = DateTime.fromJSDate(this.birthDay);
const now = DateTime.local();
var diff = now.diff(d, "years").toObject();
return diff.years;
}
@pekkis
pekkis / iiro.js
Created September 17, 2018 10:44
const { Map } = require("immutable");
function getEnvironmentVariables() {
return Map(process.env)
.filter((v, k) => k === "NODE_ENV" || k.startsWith("REACT_APP_"))
.map((v, k) => JSON.stringify(v))
.toJS();
}
module.exports = {
const myFeature = require("./src/config/workboxFeature");
addFeatures(
...,
myFeature,
)