Skip to content

Instantly share code, notes, and snippets.

View dralletje's full-sized avatar
🛰️
😱🦁🤨

Michiel Dral dralletje

🛰️
😱🦁🤨
View GitHub Profile
@dralletje
dralletje / App.js
Created September 20, 2016 18:38
Little more separate but maybe more usable.css.js
import React, { Component } from 'react';
import logo from './logo.svg';
import createStyleSheet from './createStyleSheet';
let AppLogoSpin = {
from: { transform: `rotate(0deg)` },
to: { transform: `rotate(360deg)` },
};
/*
Simple component that will not render anything.
On mount it will bind to a document event, and it will clean up on unmount
<DocumentEvent
name="scroll"
handler={updateScrollPosition}
/>
@flow
*/
@dralletje
dralletje / Page.jsx
Created June 10, 2017 16:31
My "simple" react router
// @flow
import React from 'react';
import { View, Animated, Dimensions } from 'react-native';
import { startAnimationAsync, requestAnimationFrameAsync } from './utils';
import type { AnimationInput } from './transitions';
import TransitionDelayer from './TransitionDelayer';
type EndResult = { finished: boolean };
@dralletje
dralletje / ReduxReact.jsx
Created June 20, 2017 23:38
The all new Redux React
import React from 'react';
import { connect } from 'react-redux';
export class Lifecycle extends React.Component {
props: {
componentDidMount?: () => mixed,
};
componentDidMount() {
if (this.props.componentDidMount) {
this.props.componentDidMount();
@dralletje
dralletje / MetaComponents.jsx
Created June 21, 2017 23:36
Meta components, agnostic of literally everything
// @flow
import React from 'react';
import shallowEqual from 'shallowequal';
// Still not sure what I should call this
export class EmptyC extends React.Component {
render() {
return null;
}
@dralletje
dralletje / 1 Hey.md
Last active October 22, 2017 17:04
Changelog voor app - inclusief wat te testen

App update nummer 1.4 (1.25) staat nu op testflight.

Hij is verbonden met het http://test-portal.ubutler.nl.

Dat portal heeft ook een voorbeeld van hoe je bericht er uit gaat zien, met formatting en alles.

Alles zou nu moeten werken. Er zijn nog wat dingen die natuurlijk beter zouden kunnen, maar voor zover ik kon vinden geen bugs.

import React from 'react';
import RNFetchBlob from 'react-native-fetch-blob';
import { EmptyC, Lifecycle } from '@ubutler/utils/MetaComponents';
import { RemoteMethod } from '../../MeteorComponents';
const chatapp_get_jpeg_upload_method = {
remote: (meteor, token) => {
return meteor.method({
name: 'chatapp_get_jpeg_upload',
// @flow
const useful_times = {
ten_am_monday: 1500884100000,
};
// '2017-07-27T21:29:45.301'
const base_time_timestamp = useful_times.ten_am_monday;
const Original_Date = Date;
// @flow
import React from 'react';
import shallowEqual from 'shallowequal';
/*
// Weird example, but I hope you get the point
<Compose
toggle={fn =>
<State initialValue={false} children={(value, change) => ({ value, change })} />
//let REPORT_TO_PDF_URL = 'http://localhost:5000'; // For testing locally
let REPORT_TO_PDF_URL = 'https://report-to-pdf.herokuapp.com';
let download_pdf_from_html = async ({ html_body, pdf_options, filename }) => {
let resp = await fetch(`${REPORT_TO_PDF_URL}/request_pdf_path`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ html_body, pdf_options, filename }),