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
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
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
UPDATE working on this here!
so… I've had this weird idea recently...
In git (and in other secure + distributed systems) you have a tree of hashes where each object is identified by it's hash and objects contain pointers to other objects. They just have the hash of other objects stored inside them.
function run(generator) { | |
var iterator = generator(resume); | |
var data = null, yielded = false; | |
iterator.next(); | |
yielded = true; | |
check(); | |
function check() { | |
while (data && yielded) { |
<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(); |
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.
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 loadinginvestigated/completed:
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; |