Skip to content

Instantly share code, notes, and snippets.

View mystroken's full-sized avatar
🍊

Mystro Ken mystroken

🍊
View GitHub Profile
@SuddenDev
SuddenDev / !useLocoScroll.js
Last active October 26, 2022 10:54
React (Gatsby) + Locomotive Scroll + Greensock (Gsap) + Scrolltrigger
// <DIR>/src/hooks/useLocoScroll.js
import gsap from "gsap";
import ScrollTrigger from "gsap/ScrollTrigger";
import { useEffect } from "react";
import LocomotiveScroll from "locomotive-scroll";
// REPLACE THIS WITH YOUR STYLES
import "@styles/locomotive-scroll.scss";
@slikts
slikts / react-memo-children.md
Last active May 17, 2024 16:39
Why using the `children` prop makes `React.memo()` not work

nelabs.dev

Why using the children prop makes React.memo() not work

I've recently ran into a pitfall of [React.memo()][memo] that seems generally overlooked; skimming over the top results in Google just finds it mentioned in passing in a [React issue][regit], but not in the [FAQ] or API [overview][react-api], and not in the articles that set out to explain React.memo() (at least the ones I looked at). The issue is specifically that nesting children defeats memoization, unless the children are just plain text. To give a simplified code example:

const Memoized = React.memo(({ children }) => (<div>{children}</div>));
// Won't ever re-render
<Memoized>bar</Memoized>
// Will re-render every time; the memoization does nothing
Chapter 02. Your First Step with WebGL<br>
ch02/HelloCanvas: https://jsfiddle.net/8Observer8/2gky294r/<br>
ch02/HelloPoint1: https://jsfiddle.net/8Observer8/cc72u1u5/<br>
ch02/HelloPoint2: https://jsfiddle.net/8Observer8/uxw657ud/<br>
ch02/ClickedPoints: https://jsfiddle.net/8Observer8/xf4fnc0o/<br>
ch02/ColoredPoints: https://jsfiddle.net/8Observer8/gkkmnpga/<br>
Chapter 03. Drawing and Transforming Triangles<br>
ch03/MultiPoint: https://jsfiddle.net/8Observer8/cty1120m/<br>
ch03/HelloTriangle: https://jsfiddle.net/8Observer8/wk4sksnw/<br>
@teoyoung
teoyoung / must-see
Last active December 26, 2023 12:17
WebGl courses + tutorials
---------------------------------------
1. Great GLSL course
https://thebookofshaders.com/
https://thebookofshaders.com/?lan=ru (russian language)
2. WebGl basics
https://webglfundamentals.org
https://webglfundamentals.org/webgl/lessons/ru (russian language)
@luruke
luruke / PostFX.js
Last active January 13, 2024 09:05
Simple example of postprocessing in three.js
/*
To use it, simply declare:
`const post = new PostFX(rendering);`
Then on update, instead of:
`rendering.render(scene, camera);`
replace with:
`post.render(scene, camera);`
*/
import {
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active May 19, 2024 10:45
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@mystroken
mystroken / article-item-list.html
Last active November 8, 2021 19:37
Structured Data Markups using Microdata - https://schema.org
<article role="article" itemid="http://example.com/article-1" itemscope itemtype="http://schema.org/BlogPosting">
<link itemprop="mainEntityOfPage" href="http://example.com/article-1" />
<h2 itemprop="headline">
<a itemprop="url" href="#" title="">Article title</a>
Coming this April, HBO NOW will be available exclusively in the U.S. on Apple TV and the App Store.
</h2>
<img itemprop="image" src="http://images.apple.com/live/2015-mar-event/images/573cb_xlarge_2x.jpg">
<p>
Published by <cite itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Mystro Ken</span></cite>
<time itemprop="datePublished" datetime="2015-03-09T13:08:00-07:00">March 9, 2015 1:08PM</time>
@bendc
bendc / raf-boilerplate.js
Created August 28, 2017 13:52
rAF tutorial: boilerplate code
"use strict";
// animation utils
// ===============
const trackTime = id => {
const [entry] = performance.getEntriesByName(id);
if (!entry) {
performance.mark(id);
@paulund
paulund / phpcs.xml
Created August 20, 2017 16:50
PHP PSR-2 CodeSniffer Config for Laravel
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The description tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
@baptistebriel
baptistebriel / gist:29e761fbc7cc5923cf6b99444a2935c4
Created August 9, 2017 17:44
compress mp4 video using ffmpeg
// http://ericholsinger.com/install-ffmpeg-on-a-mac
ffmpeg -i input.mp4 -vcodec h264 -acodec mp3 output.mp4