Skip to content

Instantly share code, notes, and snippets.

@ajbetteridge
ajbetteridge / Javascript: Filesystem read file
Created November 29, 2011 14:33 — forked from davglass/gist:876882
Javascript: Filesystem read file
var fs = require('fs');
var str = fs.readFileSync('./test.html', encoding='utf8');
YUI().use('node', function(Y) {
Y.config.doc.innerHTML = str;
});
YUI().use('nodejs-dom', function(Y) {
// Y.Browser
{
window, //fake window
document, //jsdom document
self, //window
location, //window.location, has an href == __filename
navigator //Fake navigator, appVersion => Node version, appName => Node.js, userAgent => Custom for Node ;)
}
});
YUI().use('nodejs-dom', function(Y) {
var document = Y.Browser.document;
document.createElement('div');
});
YUI().use('event', 'io', 'nodejs-dom', function(Y) {
//Do your stuff
//Inside the request handler callback:
//Now each request get's a new DOM and not a shared one.
Y.use('nodejs-dom', function(Y) {
var document = Y.Browser.document;
document.createElement('div');
});
});
@ajbetteridge
ajbetteridge / jquery.ba-tinypubsub.js
Created March 9, 2012 16:42 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
<list>.append(value_to_append)
<list>.clear() - clear the list
<list>.delete(position_in_list)
<list>[x:y] - sublist from x (inclusive) to y(non-inclusive)
x = [] - create a list
y = list() - create a new list
z = list('abc') - create a list with elements 'a', 'b', 'c'
@ajbetteridge
ajbetteridge / CloudsResources.md
Created March 27, 2020 09:03 — forked from pixelsnafu/CloudsResources.md
Useful Resources for Rendering Volumetric Clouds

Volumetric Clouds Resources List

  1. A. Schneider, "Real-Time Volumetric Cloudscapes," in GPU Pro 7: Advanced Rendering Techniques, 2016, pp. 97-127. (Follow up presentations here, and here.)

  2. S. Hillaire, "Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite" in Physically Based Shading in Theory and Practice course, SIGGRAPH 2016. [video] [course notes] [scatter integral shadertoy]

  3. [R. Högfeldt, "Convincing Cloud Rendering – An Implementation of Real-Time Dynamic Volumetric Clouds in Frostbite"](https://odr.chalmers.se/hand