Skip to content

Instantly share code, notes, and snippets.

🙈
Back to Work

Sjors van Heuveln sjorsvanheuveln

🙈
Back to Work
Block or report user

Report or block sjorsvanheuveln

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sjorsvanheuveln
sjorsvanheuveln / Time.jsx
Created Apr 7, 2018
A simple Time object that allows you to add, subtract and print times.
View Time.jsx
export function Time(hours, minutes) {
this.h = hours;
this.m = minutes;
this.add = (h, m) => {
this.h = (this.h + h) % 24;
this.h = this.h + Math.floor((this.m + m) / 60);
this.m = (this.m + m) % 60;
return this; // for method chaining
};
@sjorsvanheuveln
sjorsvanheuveln / mathDisplay.jsx
Last active Feb 14, 2018
Display Math or Formulae in ReactJS using ES6.
View mathDisplay.jsx
import React from 'react';
import { Fraction, toTex } from 'algebra.js';
import { Node, Context } from 'react-mathjax';
function Formula(props) {
return (
<Context input="tex">
<Node inline>{props.tex}</Node>
</Context>
);
View DutchTriplets.R
#Analysis of Dutch Language Vocabulary
#Sjors van Heuveln 28-10-2017
#Analyze triplet occurrences in the Dutch Language. This script can easily source another vocab file to do new analysis.
#Functions
trimWord <- function(rawWord) {
return(unlist(strsplit(rawWord,'/'))[1]); #trims off ID
}
wordTriplets <- function(word, size) {
if (grepl(' ', word)) { return(); } #break if word contains spaces
View StoryBlock.jsx
import React from 'react';
import { Link } from 'react-router-dom';
import { TweenMax } from 'gsap';
import { Button, Card, CardBlock, CardHeader, Col } from 'reactstrap';
export default class StoryBlock extends React.Component {
componentWillEnter(callback) {
const el = this.container;
TweenMax.fromTo(el, 0.4, { x: 500, opacity: 0 }, { x: 0, opacity: 1, onComplete: callback });
}
@sjorsvanheuveln
sjorsvanheuveln / Box.jsx
Created Aug 26, 2017
Easy Example for ReactTransitionGroup animation in Node
View Box.jsx
import React from 'react';
import { TweenMax } from 'gsap';
export default class Box extends React.Component {
componentWillEnter(callback) {
const el = this.container;
TweenMax.fromTo(el, 0.3, { y: 100, opacity: 0 }, { y: 0, opacity: 1, onComplete: callback });
}
You can’t perform that action at this time.