Skip to content

Instantly share code, notes, and snippets.

I am attesting that this GitHub handle digitpain is linked to the Tezos account tz1gkf8EexComFBJvjtT1zdsisdah791KwBE for tzprofiles
sig:edsigtkZhdiLWq1fKRSYdEjWVL6cBxJykmv2M6pE9mYh8EBbgdJrjm7gDB6LgGxh2XKVJ1TTXWtzXTg5Pna6h5oZQ4nJzajaKJM
@whistlegraph
whistlegraph / lib.rs
Created July 20, 2018 22:49
WASM Pixel Manipulation
static mut PIXELS: [u8; 128 * 128 * 4] = [0; 128 * 128 * 4];
#[no_mangle]
pub fn update_pixels() {
// How to remove this unsafe block?
unsafe {
PIXELS[0] = 255;
PIXELS[1] = 255;
PIXELS[2] = 0;
PIXELS[3] = 255;
def('surf.graph', function (act, viewport, size) {
'use strict';
var vec2 = use('lib.vec2'),
t = use('lib.transform')({
size: size,
anchor: vec2.scal(viewport.win, 0.5)
}),
worms = {},
def('softy', function (act) {
'use strict';
act.on('prep tool', function (p) {
act.out('softy.graph.prep', p);
act.out('touch surf', {p: p, and: function (opts) {
act.out('softy.graph.spot', opts);
}});
});
@whistlegraph
whistlegraph / mobile_audio.c
Last active July 26, 2016 14:06
Emscripten SDL2 Mobile Audio
#include <SDL.h>
#include <emscripten/emscripten.h>
int eventFilter(void* userdata, SDL_Event* event){
int audio_started;
(void)(userdata);
switch(event->type){
case SDL_FINGERDOWN:
case SDL_MOUSEBUTTONDOWN:
case SDL_KEYDOWN:
@whistlegraph
whistlegraph / Makefile
Last active March 16, 2017 19:53 — forked from anonymous/ios-audio.c
SDL2 Emscripten Audio Test (for iOS)
OBJS = ios-audio.c
OBJ_NAME = "ios-audio"
mac:
mkdir -p builds/native/mac
gcc -Wall -o $(OBJ_NAME) $(OBJS) `sdl2-config --cflags --libs`;
mv $(OBJ_NAME) builds/native/mac
web:
mkdir -p builds/html
@whistlegraph
whistlegraph / menu.html
Created February 27, 2015 20:46
Gabriela Nav Structure
<nav>
<div class="top">
<ul>
<li data-bottom="one" class="current">One</li>
<li data-bottom="two">Two</li>
<li data-bottom="three">Three</li>
</ul>
</div>
<div class="bottom">
@whistlegraph
whistlegraph / gist:78b5e9e3d43ee6b5020d
Created February 4, 2015 23:21
Linking external stylesheets and JavaScript files in an HTML document.
<head> <!-- These tags should be placed within the document's head tag, but there are exceptions. -->
<link rel="stylesheet" type="text/css" href="my_stylesheet.css">
<script src="js/my_javascript.js"></script> <!-- Looks for a file called `my_javascript.js` within the directory `your_project/js/`
</head>