This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(scene, options){ | |
var opts = tools.mixin({ | |
folder: 'textures/skybox/default/', | |
filetype: 'png', | |
size: 1000000 | |
}, options || {}); | |
var urls = []; | |
['x','y','z'].forEach(function(axis){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [Forked from https://gist.github.com/2651899] | |
* | |
* A console.assert which actually stop the exectution. | |
* default console.assert() is a plain display, such as console.log() or console.error(); | |
* It doesnt stop the execution like assert() is meant to do. This is a little code to | |
* "workaround this limitation" :) | |
* | |
* Usage: | |
* console.assert(foo === bar); // Will throw if not equal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onModelLoaded: function(collada){ | |
var object = collada.scene; | |
// some stuff here | |
var mesh = object.children.filter(function(child){ | |
return child instanceof THREE.Mesh; | |
})[0]; | |
object.geometry = mesh.geometry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modify this: | |
} else if ( object instanceof THREE.Mesh ) { | |
// to: | |
} else if ( object.matrixWorld && object.geometry ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var onsuccess = function(){ | |
console.log('now the store is clean again!'); | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} | |
customers.clear(onsuccess, onerror); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var id = 1; | |
var onsuccess = function(result){ | |
if(result !== false){ | |
console.log('deletion successful!'); | |
} | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var onsuccess = function(data){ | |
console.log('Here is what we have in store ('+data.length+' items in total):'); | |
data.forEach(function(item){ | |
console.log(item); | |
}); | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updatedDude = { | |
id: 1, // or whatever id our dude has | |
firstname: 'John', | |
lastname: 'Doe', | |
age: 53, // dude is now a year older | |
emails: [ | |
'[email protected]', | |
'[email protected]' | |
] | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var id = 1; // Or whatever you got returned. | |
var onsuccess = function(data){ | |
console.log('here is our dude:', data); | |
} | |
var onerror = function(error){ | |
console.log('Oh noes, sth went wrong!', error); | |
} | |
customers.get(id, onsuccess, onerror); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dude = { | |
firstname: 'John', | |
lastname: 'Doe', | |
age: 52, | |
emails: [ | |
'[email protected]', | |
'[email protected]' | |
] | |
}; |