Skip to content

Instantly share code, notes, and snippets.

View jonathanlurie's full-sized avatar
🐛
I like to code things

Jonathan Lurie jonathanlurie

🐛
I like to code things
View GitHub Profile
Seven different types of CSS attribute selectors
// This attribute exists on the element
[value]
// This attribute has a specific value of cool
[value='cool']
// This attribute value contains the word cool somewhere in it
[value*='cool']
😀 Grinning Face
😁 Beaming Face With Smiling Eyes
😂 Face With Tears of Joy
🤣 Rolling on the Floor Laughing
😃 Grinning Face With Big Eyes
😄 Grinning Face With Smiling Eyes
😅 Grinning Face With Sweat
😆 Grinning Squinting Face
😉 Winking Face
😊 Smiling Face With Smiling Eyes
@andrewharvey
andrewharvey / polygon-with-a-hole.geojson
Created March 10, 2018 02:21
A GeoJSON Polygon with a hole
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ahmedhosny
ahmedhosny / nrrd_to_nifti.py
Created December 12, 2017 15:49
nrrd to nifti
import nrrd # pip install pynrrd
import nibabel as nib # pip install nibabel
import numpy as np
# load nrrd
_nrrd = nrrd.read('/path/to/nrrd.nrrd')
data = _nrrd[0]
header = _nrrd[1]
print data.shape, header
@jam2-hey
jam2-hey / xiaolin-wu.js
Created September 25, 2016 05:04
Xiaolin Wu's line algorithm is js (es6)
class XiaolinWu {
static integerPart(v) {
let isNeg = (v < 0) ? -1 : 1;
let abs = Math.abs(v);
let integerPart = Math.floor(abs);
return integerPart * isNeg;
}
@nvictus
nvictus / loadnpy.js
Last active February 11, 2025 20:36
NumPy binary file parser for javascript
// Client-side parser for .npy files
// See the specification: http://docs.scipy.org/doc/numpy-dev/neps/npy-format.html
var NumpyLoader = (function () {
function asciiDecode(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
function readUint16LE(buffer) {
var view = new DataView(buffer);
var val = view.getUint8(0);
@revolunet
revolunet / web-audio-fetch-stream.js
Last active June 30, 2024 09:21
Web Audio streaming with fetch API
//
// loads remote file using fetch() streams and "pipe" it to webaudio API
// remote file must have CORS enabled if on another domain
//
// mostly from http://stackoverflow.com/questions/20475982/choppy-inaudible-playback-with-chunked-audio-through-web-audio-api
//
function play(url) {
var context = new (window.AudioContext || window.webkitAudioContext)();
@bellbind
bellbind / fragment.glsl
Last active January 31, 2024 14:56
[webgl2]example for webgl2 (with glsl3)
#version 300 es
precision highp float;
//invariant gl_FragCoord;
uniform Screen {
vec2 wh;
} screen;
uniform Timer {
int count;
@zz85
zz85 / mesh_simplify.html
Last active November 7, 2023 02:10
Fast Quadric Mesh Simplification JS port
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - modifier - Fast Quadric Mesh Simplification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #f0f0f0;