Skip to content

Instantly share code, notes, and snippets.

View pissang's full-sized avatar

Yi Shen pissang

View GitHub Profile
@mourner
mourner / index.html
Last active December 2, 2019 02:29
Mapbox GL JS Puppeteer benchmark
<!doctype html>
<meta charset="utf-8">
<title>Benchmark</title>
<body></body>
<style>html, body, #map { height: 100%; margin: 0; } </style>
<div id="map"></div>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.40.0/mapbox-gl.js'></script>
<!-- <script src="mapbox-gl.js"></script> -->
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 20, 2024 22:17
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@mritzco
mritzco / install.md
Last active September 2, 2022 00:11
Running AR.js sample locally
@mattdesl
mattdesl / IceMaterial.js
Last active May 17, 2024 09:48
fast subsurface scattering in ThreeJS PBR material — see "TRANSLUCENCY" in the frag shader
const glslify = require('glslify');
const path = require('path');
const assign = require('object-assign');
const defined = require('defined');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
@eliasdaler
eliasdaler / OBB.cpp
Last active April 28, 2024 20:56
OBB collision check and resolution using SAT (SFML, 2D)
// SAT collision check and resolution
// Public domain
// Usage example:
// if (testCollision(obb1, obb2, mtv)) { // obb1, obb2 - sf::RectangleShape, mtv - sf::Vector2f
// obb1.move(mtv);
// }
static const float NORMAL_TOLERANCE = 0.0001f;
using RectVertexArray = std::array<sf::Vector2f, 4>;
@veltman
veltman / README.md
Last active September 12, 2020 15:07
Triangulation morphing #2
@TheRealMJP
TheRealMJP / Tex2DCatmullRom.hlsl
Last active May 7, 2024 07:11
An HLSL function for sampling a 2D texture with Catmull-Rom filtering, using 9 texture samples instead of 16
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize)
{
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at
// location [1, 1] in the grid, where [0, 0] is the top left corner.
float2 samplePos = uv * texSize;
@manojpandey
manojpandey / rgb2lab.py
Created August 12, 2016 10:34
RGB to CIELab color space conversion
# RGB to Lab conversion
# Step 1: RGB to XYZ
# http://www.easyrgb.com/index.php?X=MATH&H=02#text2
# Step 2: XYZ to Lab
# http://www.easyrgb.com/index.php?X=MATH&H=07#text7
def rgb2lab(inputColor):
@merolhack
merolhack / slugify.js
Last active May 29, 2023 11:30 — forked from mathewbyrne/slugify.js
Javascript Slugify: For accents and other latin characters
function slugify(text)
{
var from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
var to = "aaaaaeeeeeiiiiooooouuuunc------";
_.each( from, function( character, i ) {
text = text.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
});
return text
.toString() // Cast to string
.toLowerCase() // Convert the string to lowercase letters
@evantoli
evantoli / GitConfigHttpProxy.md
Last active May 20, 2024 08:42
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like: