Skip to content

Instantly share code, notes, and snippets.

View emnh's full-sized avatar

Eivind Magnus Hvidevold emnh

View GitHub Profile
@emnh
emnh / index.html
Created April 1, 2023 11:42
Concentric Rainbow Canvas
<!DOCTYPE html>
<html>
<head>
<title>Concentric Rainbow Canvas</title>
<style>
canvas {
border: 1px solid black;
}
</style>
</head>
@emnh
emnh / BuggyPaddleHTML5.js
Last active April 3, 2022 06:55
Buggy paddle in HTML5
// https://jsbin.com/siquxosaho/edit?html,js,output
const table = document.createElement('table');
const width = 10;
const height = 5;
const cellWidth = 60;
const cellHeight = 30;
const paddleWidth = 80;
const colors = ['red', 'blue', 'green' ];
const cells = {};
@emnh
emnh / copyAndroid.ps1
Created March 1, 2019 16:56
Android (Huawei P10 Lite) File Copier
# http://blogs.technet.com/b/heyscriptingguy/archive/2013/04/26/use-powershell-to-work-with-windows-explorer.aspx
$o = New-Object -com Shell.Application
$folder = $o.NameSpace(0x11)
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb774096(v=vs.85).aspx
# ShellSpecialFolderConstants.ssfDRIVES == 0x11
$items = $folder.Items()
for ($i= 0; $i -lt $items.Count; $i++) {
write-output ([string]$i + ": " + $items.Item($i).Name)
@emnh
emnh / v8-chrome-debug-alloc.diff
Created September 3, 2018 09:49
V8 Chrome Debug JavaScript Memory Allocations
diff --git a/src/profiler/allocation-tracker.cc b/src/profiler/allocation-tracker.cc
index 21843325f9..315239e658 100644
--- a/src/profiler/allocation-tracker.cc
+++ b/src/profiler/allocation-tracker.cc
@@ -214,16 +214,28 @@ void AllocationTracker::AllocationEvent(Address addr, int size) {
heap->CreateFillerObjectAt(addr, size, ClearRecordedSlots::kNo);
Isolate* isolate = heap->isolate();
+ bool printStack = false;
+
@emnh
emnh / test.js
Created May 30, 2014 16:15
Google XSS Game
alert("helo");
@emnh
emnh / jsbin.gefuv.coffee
Created March 9, 2014 19:34
Planets in GLSL Heroku Sandbox
# original Planets at https://github.com/emnh/graphgame/blob/master/game.py
# non-glsl.heroku.com based pretrial: http://jsbin.com/aCEcohi/218/edit
# looks similar to http://glsl.heroku.com/e#9955.0
# based on GLSL sandbox at https://github.com/mrdoob/glsl-sandbox/blob/master/static/index.html
# Planets code
# `// noprotect `
Planets = {}
@emnh
emnh / jsbin.aCEcohi.coffee
Created March 9, 2014 16:20
Planets in GLSL
# Planets code
# looks similar to http://glsl.heroku.com/e#9955.0
# `// noprotect `
Planets = {}
init = ->
# Creates canvas 320 × 200 at 10, 50
@emnh
emnh / jsbin.aCEcohi.coffee
Last active August 29, 2015 13:57
GLSL in JSBin with CoffeeScript
# http://jsbin.com/aCEcohi/50/edit
cv = document.getElementById("canvas")
gl = cv.getContext("experimental-webgl")
type = [gl.VERTEX_SHADER,gl.FRAGMENT_SHADER]
fs_head = "
precision mediump float;
uniform float iGlobalTime;
uniform vec2 iResolution;
uniform float time;
@emnh
emnh / mori.js
Created November 29, 2013 15:33
mori.js 0.2.4 from npm
(function(definition){if(typeof exports==="object"){module.exports=definition();}else if(typeof define==="function"&&define.amd){define(definition);}else{mori=definition();}})(function(){return function(){
function aa(){return function(a){return a}}function f(a){return function(){return this[a]}}function m(a){return function(){return a}}var n,ba=this;
function p(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}var ca="closure_uid_"+(1E9*Math.random()>>>0),da=0;function
code = "
1 + 2
"
options = {
comment: false
range: false
loc: false
tolerant: false
}