Skip to content

Instantly share code, notes, and snippets.

View rohan-deshpande's full-sized avatar
🚀
Just shipped https://getnebula.app check it out!

Rohan Deshpande rohan-deshpande

🚀
Just shipped https://getnebula.app check it out!
View GitHub Profile
@rohan-deshpande
rohan-deshpande / TransformationShader.js
Last active January 1, 2021 04:39 — forked from jeanlescure/TransformationShader.js
ThreeJS: Vertex shader for translating, scaling, and rotating. Fragment shader for adding texture and controlling opacity.
THREE.TransformationShader = {
defines: {},
uniforms: {
"tDiffuse": { type: "t", value: texture },
"opacity": { type: "f", value: 1.0 },
"translationX": { type: "f", value: 1.0 },
"translationY": { type: "f", value: 1.0 },
"translationZ": { type: "f", value: 1.0 },
"scaleX": { type: "f", value: 1.0 },
@rohan-deshpande
rohan-deshpande / macos-app-icon.md
Created July 12, 2020 07:15 — forked from jamieweavis/macos-app-icon.md
How to make an app icon for macOS using iconset & iconutil

How to create a .icns macOS app icon

How to make an app icon for macOS using iconset & iconutil

Saving images

Save your app icon with the following names & dimensions:

Name Dimensions
icon_16x16.png 16x16
@rohan-deshpande
rohan-deshpande / macos-app-icon.md
Created July 12, 2020 07:15 — forked from jamieweavis/macos-app-icon.md
How to make an app icon for macOS using iconset & iconutil

How to create a .icns macOS app icon

How to make an app icon for macOS using iconset & iconutil

Saving images

Save your app icon with the following names & dimensions:

Name Dimensions
icon_16x16.png 16x16
@rohan-deshpande
rohan-deshpande / CONDITIONALLY_ASYNC_LOAD_BY_VIEWPORT_SIZE.md
Last active June 23, 2020 23:34
What is the best way to conditionally async load components based on initial viewport size?

Question:

Thinking about this in a nextjs context, let's say we have two components Video and AnimatedGif. For larger screens, we want to load the video, but for smaller screens, and perhaps slower devices, we want to show the gif. We also want to async load these, because they shouldn't block the rest of the page. They are media items so they don't need to be SSR'd, and also it would be good if this could be done with Suspense in mind. Any ideas?

Answer:

Create a custom hook, something like useDeviceAndViewport() that returns the relevant info. You need to know the network status, the viewport dimensions and whether the element is within the viewport.

@rohan-deshpande
rohan-deshpande / README.md
Created December 27, 2019 04:36 — forked from donmccurdy/README.md
Convert legacy three.js (JSON) files to glTF 2.0

legacythree2gltf.js

Converts legacy JSON models (created by the three.js Blender exporter, for THREE.JSONLoader) to glTF 2.0. When original .blend files are available, prefer direct export from Blender 2.80+.

NOTE: JSON files created with .toJSON() use a newer JSON format, which isn't deprecated, and these are still supported by THREE.ObjectLoader. This converter does not support that newer type of JSON file.

Installation:

npm install canvas vblob three
@rohan-deshpande
rohan-deshpande / nginx.conf
Created May 26, 2019 21:45
NGINX config for a node-restify API and public website running via Laravel Forge
# NOTE: Replace forge.site.com with your site domain, a lot of this stuff will be auto generated by forge.
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/forge.site.com/before/*;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name forge.site.com;
root /home/forge/forge.site.com/;
@rohan-deshpande
rohan-deshpande / brew_symlink_error_sierra.md
Created August 2, 2018 05:19 — forked from dalegaspi/brew_symlink_error_sierra.md
Homebrew Symlink errors in Mac OSX High Sierra