Skip to content

Instantly share code, notes, and snippets.

Andreas Borgen Sphinxxxx

Block or report user

Report or block Sphinxxxx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Sphinxxxx
Sphinxxxx / index.html
Last active Mar 22, 2020
Vue bar chart race
View index.html
<script>
console.clear();
//Super-duper-lightweight tweening "library":
//https://gist.github.com/Sphinxxxx/fc9bcc601a2f903ff167112855d0437c
function TWEEN(b,f,h,k,c){function g(a){if(d){var e=(a-d)/h;a=1>e?b+l*c(e):f;if(1<=e)return}else d=a,a=b;k(a);requestAnimationFrame(g)}c=c||function(a){return a*(2-a)};var l=f-b,d;requestAnimationFrame(g)};
</script>
<script src="//unpkg.com/vue@2"></script>
<div id="app">
@Sphinxxxx
Sphinxxxx / index.html
Created Jan 31, 2020
Multi-texture sphere
View index.html
<script>console.clear();</script>
<h2>Click the sphere to change/reset textures</h2>
@Sphinxxxx
Sphinxxxx / tween.js
Last active Mar 22, 2020
Super-duper-lightweight tweening "library"
View tween.js
//Super-duper-lightweight tweening "library".
//An actual library like https://github.com/tweenjs/tween.js would probably be better..
function TWEEN(from, to, duration, callback, easing) {
//ease-out quad: https://github.com/tweenjs/tween.js/blob/master/src/Tween.js#L544
easing = easing || function(t) { return t * (2 - t); };
var diff = to - from,
startTime;
function anim(time) {
@Sphinxxxx
Sphinxxxx / index.html
Created Jun 12, 2019
Stolpejakten 2018
View index.html
<main>
<div id="map-canvas"></div>
<!--div id="summary" class="info-pane" ></div-->
</main>
View extract-pdf-images.markdown
@Sphinxxxx
Sphinxxxx / index.html
Created Jan 13, 2019
Rubik's cube loader
View index.html
<div class="loader"></div>
@Sphinxxxx
Sphinxxxx / index.html
Last active Nov 19, 2018
Web Audio Spectrogram
View index.html
<script>
console.clear();
if (!window.AudioContext) {
if (!window.webkitAudioContext) {
alert('AudioContext not supported!');
}
window.AudioContext = window.webkitAudioContext;
}
@Sphinxxxx
Sphinxxxx / index.md
Last active Jan 3, 2020
DOM node tree walker
View index.md

A general-purpose DOM tree walker based on https://stackoverflow.com/questions/10730309/find-all-text-nodes-in-html-page (Phrogz' answer and its comments).

The textNodesUnder() function would then look like this:

function textNodesUnder(el) {
    return walkNodeTree(el, {
        inspect: n => !['STYLE', 'SCRIPT'].includes(n.nodeName),
        collect: n => (n.nodeType === 3),
        //callback: n => console.log(n.nodeName, n),
    });
You can’t perform that action at this time.