Skip to content

Instantly share code, notes, and snippets.

View mattgperry's full-sized avatar

Matt Perry mattgperry

View GitHub Profile
@mattgperry
mattgperry / drag-test-utils.tsx
Created March 31, 2020 07:50
Framer Motion drag utils
import * as React from "react"
import sync from "framesync"
import { MotionPlugins } from "../../motion/context/MotionPluginContext"
import { act } from "react-dom/test-utils"
import { fireEvent } from "@testing-library/dom"
export type Point = {
x: number
y: number
}
const Component = () => {
const frameCount = useRef(0)
const prevValues = useRef()
return <motion.div transformValues={values => {
frameCount.current++
const valuesToReturn = isEven(frameCount.current) ? prevValues.current : values
prevValues.current = values
Hi [recruiter's name],
Thanks for getting in touch. Sorry, but I'm not open to roles at Facebook.
Your company's current stance on political advertising is a conscious choice that's dangerously stoking divisions in society in the name of profit.
Also, while I understand the legal framework that allows them to do so, I disagree with massive profit-making American companies like Facebook coming over here and structuring themselves in a way that allows them to avoid local taxation. These companies then underpay European developers in relation to their west coast counterparts. Given our government's aptitude for taxing salaried individuals over corporations, this is another two methods your company uses to withhold the profits we generate for you.
Please exclude me from your searches until your company discovers its moral compass
Thanks
@mattgperry
mattgperry / useAnimationLoop.js
Last active August 8, 2019 17:14
Use Framesync via a render loop
import sync, { cancelSync } from "framesync";
import { useEffect } from "react";
/**
The code inside useAnimationLoop is guaranteed to run once a frame
before Framer Motion/Popmotion/Pose renders
useAnimationLoop(({ delta, timestamp }) => {
// do stuff
})
@mattgperry
mattgperry / index.js
Created May 20, 2015 09:04
requirebin sketch
var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var redshift = require('redshift');
var renderAction = redshift.newAction();
// 1: Create a function that declares what the DOM should look like
function render(count) {
return h('div', {