Skip to content

Instantly share code, notes, and snippets.

View vincentriemer's full-sized avatar

Vincent Riemer vincentriemer

View GitHub Profile
@vincentriemer
vincentriemer / RobotoDraft.css
Last active September 30, 2018 00:51
RobotoDraft hosted @font-face (from Google's design site)
@font-face {
font-family: 'RobotoDraft';
font-style: normal;
font-weight: 400;
src: local('RobotoDraft'), local('RobotoDraft-Regular'), url(https://fonts.gstatic.com/s/robotodraft/v1/0xES5Sl_v6oyT7dAKuoni4gp9Q8gbYrhqGlRav_IXfk.woff2) format('woff2'), url(https://fonts.gstatic.com/s/robotodraft/v1/0xES5Sl_v6oyT7dAKuoni7rIa-7acMAeDBVuclsi6Gc.woff) format('woff');
}
@font-face {
font-family: 'RobotoDraft';
font-style: normal;
@vincentriemer
vincentriemer / AnimationHelpers.js
Last active August 29, 2015 14:05
Javascript Animation Snippets
// Cross-browser compatible scroll position
function getScrollPosition() {
return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
}
// requestAnimationFrame polyfill
(function requestAnimationFramePolyfill() {
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];

sorting

module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@vincentriemer
vincentriemer / ResizeObservable.js
Created December 4, 2017 20:15
React Component prototype that provides element query functionality via ResizeObserver
// @flow
import * as React from "react";
import ResizeObserver from "resize-observer-polyfill";
import invariant from "invariant";
type Entry = {
+contentRect: {
+width: number,
+height: number
@font-face {
font-family: System;
src: local("-apple-system"), local("BlinkMacSystemFont"), local("Segoe UI"), local("Roboto"), local("Ubuntu"), local("Helvetica Neue"), local("sans-serif");
}
@vincentriemer
vincentriemer / react-image-objectfit-fallback.js
Last active November 15, 2021 17:36
Image React Component with `object-fit` Fallback
// @flow
import * as React from "react";
import getStyleProp from "desandro-get-style-property";
const supportsObjectFit = !!getStyleProp("objectFit");
type Props = React.ElementProps<"img">;
export default class Image extends React.Component<Props> {
declare module "yoga-dom" {
declare opaque type AlignAuto;
declare opaque type AlignFlexStart;
declare opaque type AlignCenter;
declare opaque type AlignFlexEnd;
declare opaque type AlignBaseline;
declare opaque type AlignSpaceBetween;
declare opaque type AlignSpaceAround;
declare type Align =
| AlignAuto
@vincentriemer
vincentriemer / Observable.re
Last active March 3, 2018 21:29
zen-observable reason bindings
type t('a, 'e);
module Subscription = {
type t;
[@bs.get] external closed : t => bool = "";
[@bs.send.pipe : t] external unsubscribe : unit => unit = "";
};
module Observer = {
type t('a, 'e);
@vincentriemer
vincentriemer / subreddit-face-average.js
Created March 13, 2018 17:14
Subreddit Face Averaging Script
import * as fs from "fs";
import * as path from "path";
import * as url from "url";
import { exec } from "child_process";
import cuid from "cuid";
import snoowrap from "snoowrap";
import throat from "throat";
import mmm from "mmmagic";
import axios from "axios";