If you are like me, stuck with this error :
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
It's an error of a too big object that is trying to be saved in memory (RAM).
Step to reproduce :
If you are like me, stuck with this error :
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
It's an error of a too big object that is trying to be saved in memory (RAM).
Step to reproduce :
# Florent Berthelot Theme - Insipration bira theme, candy theme | |
function git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref#refs/heads/}$(parse_git_dirty)$(get_stash_count)${ZSH_THEME_GIT_PROMPT_SUFFIX}" | |
} | |
get_stash_count() { | |
if [[ -n $(git stash list 2> /dev/null) ]]; then | |
echo "${ZSH_THEME_GIT_PROMPT_STASH_PREFIX}$(git rev-list --walk-reflogs --count refs/stash)${ZSH_THEME_GIT_PROMPT_STASH_SUFFIX}" | |
else |
// Copy the code below in http://tddbin.com/ | |
// Simplify the function below | |
function exercise1(student) { | |
if(student && student) { | |
return 'you\'re a student'; | |
} | |
} | |
function exercise2(student) { |
'use strict'; | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const {resolve} = path; | |
module.exports = { | |
entry: [ | |
'react-hot-loader/patch', |
this.addParameter( "amplitudeMultiplier", 8 ); | |
onaudioprocess= function (e) { | |
// De même, parcours des channels | |
for (var i=0; i< e.inputs[0].length; i++) { | |
var inputBuffer = e.inputs[0][i]; | |
var outputBuffer = e.outputs[0][i]; | |
var bufferLength = inputBuffer.length; | |
//Parcours du buffer | |
for (var j=0; j<bufferLength; j++) { | |
outputBuffer[j] = inputBuffer[j] * e.parameters.amplitudeMultiplier; |
//Chargement du nœud dans l'audio contexte | |
audioContext.createAudioWorker("nodeFactory.js").then( function(factory) | |
{ | |
//Instanciation d'un nouveau nœud | |
var node = factory.createNode(); | |
//On peux utiliser les fonctions sur les audio params comme pour les autres nœuds | |
node.amplitudeMultiplier.setValueAtTime(0, audioContext.currentTime); | |
node.amplitudeMultiplier.linearRampToValueAtTime(10, audioContext.currentTime + 10); |
// Création du ScriptProcessorNode avec un buffer de 4096, 1 entrée et 1 sortie | |
var ScriptProcessorNode = audioCtx.createScriptProcessor(4096, 1, 1); | |
ScriptProcessorNode.onaudioprocess = function(audioProcessingEvent){ | |
var inputBuffer = audioProcessingEvent.inputBuffer; | |
var outputBuffer = audioProcessingEvent.outputBuffer; | |
//Parcours de channel de la source audio (par exemple: gauche et droite en stéréo) | |
for (var i=0; i < outputBuffer.numberOfChannels; i++) { | |
var inputData = inputBuffer.getChannelData(i); | |
var outputData = outputBuffer.getChannelData(i); |
// Va augmenter la fréquence de 440Hz à 456Hz linéairement pendant 10 secondes | |
oscillator.frequency.linearRampToValueAtTime(456, audioContext.currentTime + 10); |
var audioContext = new AudioContext(); | |
var oscillator = audioContext.createOscillator(); | |
oscillator.connect(audioContext.destination); | |
oscillator.start(audioContext.currentTime); |