Skip to content

Instantly share code, notes, and snippets.

View MadebyAe's full-sized avatar
🏠
Working from home

Angel Estrada MadebyAe

🏠
Working from home
View GitHub Profile
@RenaudRohlinger
RenaudRohlinger / GsapTicker.jsx
Created September 8, 2022 06:15
Synchronize gsap and r3f raf loop
import React, { useEffect } from 'react'
import gsap from 'gsap'
import { useFrame } from '@react-three/fiber'
// sync gsap raf to r3f raf
gsap.ticker.remove(gsap.updateRoot)
export const GsapTicker = () => {
const pg = React.useRef(0)
gsap.ticker.remove(gsap.updateRoot)
@designstorming
designstorming / ogl.d.ts
Last active February 6, 2021 17:40
Typescript definition for ogl.js (https://github.com/oframe/ogl)
/** Declaration file generated by dts-gen */
export class Animation {
constructor(...args: any[]);
update(...args: any[]): void;
}
export interface Position {
@shilman
shilman / storybook-docs-typescript-walkthrough.md
Last active February 20, 2024 11:37
Storybook Docs Typescript Walkthrough

Storybook Docs w/ CRA & TypeScript

This is a quick-and-dirty walkthrough to set up a fresh project with Storybook Docs, Create React App, and TypeScript. If you're looking for a tutorial, please see Design Systems for Developers, which goes into much more depth but does not use Typescript.

The purpose of this walkthrough is a streamlined Typescript / Docs setup that works out of the box, since there are countless permutations and variables which can influence docs features, such as source code display, docgen, and props tables.

Step 1: Initialize CRA w/ TS

npx create-react-app cra-ts --template typescript
@miyataken999
miyataken999 / index.html
Created March 1, 2018 15:48
ThreeJS Gradient
<div id="canvas"></div>
@kestein
kestein / Private_Crates.md
Last active March 28, 2024 10:36
Linking to a private repo in Cargo.toml

Under the dependencies section, put

<crate name>={git="ssh://git@github.com/<organization>/<reponame>.git"}

It is pretty similar to a github repo's ssh cloning link, however the : is replaced with a / and ssh:// is prepended to the URL.

git@github.com:my-organization/my-repo.git vs ssh://git@github.com/my-organization/my-repo.git

The SSH URL needs to be used because Cargo is currently unable to handle the authentication prompt that comes up when an HTTPS link is used.
Make sure that the matches the crate name in the target repo's Cargo.toml. The repo name will not override what is in the Cargo.toml if it is a different value.

@traviskaufman
traviskaufman / mdc-web-tape2mocha.js
Created February 16, 2017 21:09
one-off script to transform MDC-Web's tests from tape to mocha (https://github.com/material-components/material-components-web/issues/143)
/**
* @fileoverview one-off script to transform MDC-Web's tests from tape to mocha.
* See https://github.com/material-components/material-components-web/issues/143
*/
const fs = require('fs');
const path = require('path');
const babylon = require('babylon');
const glob = require('glob');
@tbranyen
tbranyen / hooks-theme-and-refs.js
Last active June 5, 2017 17:40
HRT: Hooks, theme, and refs! Consistent re-usable component schema.
import React, { Component, PropTypes } from 'react';
import htr from 'hooks-theme-refs';
export class Chip extends Component {
render() {
const { label, hooks, theme, refs, children, ...rest } = htr(this);
return (
<div {...rest} className={theme.chip} onClick={hooks.onClick} ref={refs.chip}>
{children}
@ebachter
ebachter / iframe_handling_in_react.js
Last active October 6, 2019 10:58
iframe handling in react
import React from 'react';
import { connect } from 'react-redux';
class PageWidget extends React.Component {
componentDidMount() {
this.ifr.onload = () => {
this.ifr.contentWindow.postMessage('hello', '*');
};
window.addEventListener("message", this.handleFrameTasks);
}
@egel
egel / auto-remove-sublime-license-popup
Last active January 28, 2024 18:31
Auto-remove Sublime's license popup
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime_plugin
import subprocess
from time import sleep
import sys
cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
log = lambda message: sys.stderr.write("Log: %s\n" % message)