This file contains 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
const getSourceNode = (audioContext, buffer) => { | |
// let's create an empty buffer | |
const source = audioContext.createBufferSource() | |
// then we assign the passed buffer to node's buffer | |
source.buffer = buffer | |
// this is will play the buffer in looping | |
source.looping = true | |
return source |
This file contains 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
// Let's add a canvas to see the graphs, a textarea to write the equation | |
// and a button to start playing | |
const context = document.querySelector('#canvas').getContext('2d') | |
const textArea = document.querySelector('#function-area') | |
const button = document.querySelector('#play-button') | |
const audioContext = new AudioContext() | |
const SAMPLE_RATE = 3000 |
This file contains 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
// doing a query to get the element on html file | |
const canvas = document.querySelector('#canvas') | |
// getting the canvas context | |
const context = canvas.getContext('2d') | |
// Let's create an Image instance | |
const baseImage = new Image() | |
// 'lena.jpg' is the image path on your file system |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style media="screen"> | |
.scrolling-indicator { | |
position: fixed; | |
top: 0; |
This file contains 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 five = require('johnny-five'); | |
var http = require('http'); | |
var Router = require('node-simple-router'); | |
var router = Router(); | |
var board = new five.Board(); | |
var server = http.createServer(router); | |
server.listen(3000); |
This file contains 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
const istanbul = require( 'browserify-istanbul' ) | |
module.exports = function(config) { | |
config.set({ | |
basePath: '', | |
frameworks: ['browserify', 'jasmine'], | |
files: [ | |
// 'js/**/*.js', | |
'js/utils/**/*.js', | |
'test/spec/*.js' |
This file contains 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
// Como o johnny five é um módulo Node.js, ele é carregado como qualquer outro | |
var five = require('johnny-five'); | |
// Instanciamos uma placa, que neste caso será a do Arduino que se comunicará com o computador | |
var board = new five.Board(); | |
// O evento de ready é disparado quando a comunicação é estabelecida entre o processo Node.js e o Arduino | |
board.on('ready', function() { | |
// Instanciamos um led no pino 13 | |
var led = new five.Led(13); |
This file contains 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 Human = function (name, age) { | |
return { | |
init: function () { | |
this.setName(name); | |
this.setAge(age); | |
}, | |
setName: function (name) { | |
this.setName = name; | |
}, |
This file contains 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
/* | |
* AppBootstrap.js - This file contains the path to Backbone, Underscore, Jquery and | |
*also the variables that which one will export | |
*/ | |
/*global require*/ | |
'use strict'; | |
require.config({ | |
shim: { |
This file contains 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 numero = 10; | |
var Calculadora = function () { | |
this.soma = function (numero1, numero2) { | |
return numero1 + numero2 | |
} |