Skip to content

Instantly share code, notes, and snippets.

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

Michiel Dral dralletje

🛰️
😱🦁🤨
View GitHub Profile
import React, { Component } from 'react';
import { isEqual, debounce } from 'lodash';
import yaml from 'js-yaml';
import Measure from 'react-measure';
import styled from 'styled-components';
import uuid from 'uuid/v1';
import md5 from 'md5';
import { Transformation2DMatrix } from './TransformationMatrix.js';
import { DocumentEvent, Absolute, Whitespace, Layer } from './Elements.js';
@dralletje
dralletje / Elements.jsx
Created June 21, 2018 23:48
Voor Timon
import React from 'react';
/*
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}
/>
*/
'atom-text-editor':
'cmd-;': 'editor:fold-current-row'
'cmd-\'': 'tabs:close-other-tabs'
//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 }),
// @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 })} />
// @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;
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',
@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.

@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 / 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();