Skip to content

Instantly share code, notes, and snippets.

View shama's full-sized avatar
✍️
writing a status message

Kyle Robinson Young shama

✍️
writing a status message
View GitHub Profile
@dlmanning
dlmanning / classy.js
Last active August 29, 2015 14:21
classy and convenient
class Foo extends Bar () {
constructor () {
super();
this.bar = 'fubar';
}
}
export function FooFactory (...args) {
return new Foo(...args);
}

When a beginner asks you "when do I use semi-colons?" would you rather say this?

// what people who say "use semicolons!!" say
class Foo {
  prop = {
  }; // yes

Disclaimer: This is an unofficial post by a random person from the community. I am not an official representative of io.js. Want to ask a question? open an issue on the node-forward discussions repo

io.js - what you need to know

io-logo-substack

  • io is a fork of node v0.12 (the next stable version of node.js, currently unreleased)
  • io.js will be totally compatible with node.js
  • the people who created io.js are node core contributors who have different ideas on how to run the project
  • it is not a zero-sum game. many core contributors will help maintain both node.js and io.js
@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@dominictarr
dominictarr / CYPHERLINK.md
Last active April 24, 2024 16:17
Cypherlinks
@creationix
creationix / run.js
Last active November 27, 2017 16:06
A tiny generator helper for consuming callback code directly
function run(generator) {
var iterator = generator(resume);
var data = null, yielded = false;
iterator.next();
yielded = true;
check();
function check() {
while (data && yielded) {
@YenTheFirst
YenTheFirst / index.html
Created March 22, 2013 07:26
recursive portals
<html>
<head>
<title>spinnin' cubes! yes! plural!</title>
<style>canvas { width: 100%; height: 100% }</style>
</head>
<body>
<script src="https://raw.github.com/mrdoob/three.js/master/build/three.js"></script>
<script>
//create basic context
var main_scene = new THREE.Scene();
@max-mapper
max-mapper / readme.md
Last active January 28, 2024 18:11
How-to: Write a node module with voxel.js

Writing node modules with voxel.js

This is a short guide that will teach you the workflows that have been figured out by the voxel.js community for writing node modules + sharing them on NPM and Github. It is assumed that you have a basic understanding of JavaScript, github and the command line (if not you can check out an introduction to git and the command line or learn JS basics from JavaScript for Cats)

The voxel-tower repository on github contains all the example code from this guide.

Table of contents

@max-mapper
max-mapper / readme.md
Last active December 14, 2015 01:58
voxel-engine to-do list

major goal: "everything is just an object and voxel-engine just deals with keeping a list of objects for collisions" via voxel-chunks

pending:

  • voxels.createChunkRadiusStream().pipe(voxels.generateChunkStream()).pipe(game.voxels) for async chunk loading
  • switched to the culled mesher so that we can implement texture atlases, which will reduce draw calls by a ton
  • implement ambient occlusion after switching to the culled mesher

investigated/completed:

@vogonistic
vogonistic / greedy.js
Last active December 12, 2015 06:19
Updated mesher that takes transparency into account. Unfortunately, it's significantly slower than current greedy.js
var GreedyMesh = (function greedyLoader() {
// contains all forward faces (in terms of scan direction)
var mask = new Int32Array(4096);
// and all backwards faces. needed when there are two transparent blocks
// next to each other.
var invMask = new Int32Array(4096);
// setting 16th bit if transparent
var kTransparentMask = 0x8000;