Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Strobl tom2strobl

View GitHub Profile
View Reveal.js
import { useState, setState, useRef } from "react";
import Observer from "@researchgate/react-intersection-observer";
import anime from "animejs";
import { ANIMATIONS } from "constants";
function handleIntersection(event, ref, delay, callback) {
if (event.isIntersecting) {
callback();
anime.set(ref, { opacity: 0 });
View BackgroundVideo.js
import ReactPlayer from 'react-player'
import { useSize } from 'react-use'
const videoConfig = {
vimeo: {
playerOptions: {
background: true
}
}
}
View datum.js
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
@tom2strobl
tom2strobl / ssl.sh
Created Nov 2, 2017
https://localhost
View ssl.sh
cd; mkdir .ssl
openssl req -newkey rsa:2048 -x509 -nodes -keyout .ssl/localhost.key -new -out .ssl/localhost.crt -subj /CN=localhost -reqexts SAN -extensions SAN -config <(cat /System/Library/OpenSSL/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:localhost')) -sha256 -days 3650
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain .ssl/localhost.crt
@tom2strobl
tom2strobl / draw.js
Last active Sep 13, 2017
draw an arc of a circle with plain math and a react render
View draw.js
function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
var angleInRadians = (angleInDegrees-90) * Math.PI / 180.0;
return {
x: centerX + (radius * Math.cos(angleInRadians)),
y: centerY + (radius * Math.sin(angleInRadians))
};
}
function describeArc(x, y, radius, startAngle, endAngle){
var start = polarToCartesian(x, y, radius, endAngle);
@tom2strobl
tom2strobl / index.js
Created May 20, 2016
Quick script that reads all files on given paths and writes the occurences of arguments to a __() function to a JSON and CSV file. Useful for localization and internationalization.
View index.js
'use strict';
const Promise = require("bluebird");
const _ = require("lodash");
const glob = require("glob");
const async = require("async");
const fs = require("fs");
const jsonfile = require("jsonfile");
const json2csv = require("json2csv");
Promise.promisifyAll(fs);
@tom2strobl
tom2strobl / 01_add_cors.config.yaml
Created Feb 11, 2016 — forked from vsviridov/01_add_cors.config.yaml
Add CORS to Nginx on AWS Elastic Beanstalk
View 01_add_cors.config.yaml
container_commands:
01_fix_static_cors:
command: "/tmp/fix_static_cors.sh"
files:
"/tmp/fix_static_cors.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash