Skip to content

Instantly share code, notes, and snippets.

View 72lions's full-sized avatar
👋

Thodoris Tsiridis 72lions

👋
View GitHub Profile
@72lions
72lions / keybase.md
Created April 15, 2014 09:57
keybase.md

Keybase proof

I hereby claim:

  • I am 72lions on github.
  • I am 72lions (https://keybase.io/72lions) on keybase.
  • I have a public key whose fingerprint is DFDF 68CA 58D4 3CEA 1DEF 8797 94D4 DF3C AB45 E082

To claim this, I am signing this object:

@72lions
72lions / replace.audiobuffer.from.audiosource.js
Created January 14, 2013 09:25
Replaces the AudioBuffer of an AudioSource
// Adding a bit of scheduling so that we won't have single digit milisecond overlaps.
// Thanks to Chris Wilson for his suggestion.
var scheduledTime = 0.015;
try {
_audioSource.stop(scheduledTime);
} catch (e) {}
_audioSource = _context.createBufferSource();
_audioSource.buffer = _audioBuffer;
@72lions
72lions / concat.array.buffers.js
Created January 14, 2013 09:22
Concatenates two ArrayBuffers
/**
* Creates a new Uint8Array based on two different ArrayBuffers
*
* @private
* @param {ArrayBuffers} buffer1 The first buffer.
* @param {ArrayBuffers} buffer2 The second buffer.
* @return {ArrayBuffers} The new ArrayBuffer created out of the two.
*/
var _appendBuffer = function(buffer1, buffer2) {
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
@72lions
72lions / create.audio.buffer.from.array.buffer.js
Created January 14, 2013 09:11
Creates an AudioBuffer from and ArrayBuffer
/**
* Is triggered when a chunk is loaded
*/
var _onChunkLoaded = function() {
// Concat two ArrayBuffers into a new one
_activeBuffer = _appendBuffer(_activeBuffer, _request.response);
// Use decodeAudioData for creating an AudioBuffer,
// so that we don't block the main thread.
@72lions
72lions / loading.binary.data.xmlhttprequest.js
Created January 14, 2013 09:03
Loading a binary data with the HXMLHttpRequest object
/**
* It is responsible for loading all the different chunks
*
* @private
* @type {XMLHttpRequest}
*/
var _request = new XMLHttpRequest();
// Set the responseType to arraybuffer
_request.responseType = 'arraybuffer';
@72lions
72lions / frameworkjs.retrieve.get.an.already.instantiated.model.js
Created February 29, 2012 15:33
FrameworkJS.retrieve - Get an already instantiated model
var alreadyInstantiatedGridModel = FrameworkJS.retrieve(
'gridModel',
'models.Grid');
@72lions
72lions / frameworkjs.retrieve.instantiate.a.model.js
Created February 29, 2012 15:31
FrameworkJS.retrieve - Instantiate a model
var instanceOfGridModel = FrameworkJS.retrieve(
'gridModel',
'models.Grid');
@72lions
72lions / Frameworkjs.extend.extending.a.model.js
Created February 29, 2012 15:30
FrameworkJS.extend - Extending a model
FrameworkJS.extend(function() {
// Overwritting the properties
this.name = 'GridModel';
// Initial data
this._data = {title: "MyTitle", prop1: 'Property 1'};
}, FrameworkJS.Model, 'models.Grid');
@72lions
72lions / frameworkjs.retrieve.get.an.instance.of.a.view.js
Created February 29, 2012 15:07
FrameworkJS.retrieve - Get an instance of a view
var gridView = FrameworkJS.retrieve(
'SomeId',
'views.Grid');
@72lions
72lions / frameworkjs.retrieve.get.an.already.instantiated.view.js
Created February 29, 2012 15:01
FrameworkJS.retrieve - Retrieve an already instantiated view
var alreadyInstantiatedGridView = FrameworkJS.retrieve(
'SomeId',
'views.Grid');