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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "ES6", | |
"module": "commonjs" | |
} | |
} |
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 animais = [ | |
{ especie: 'Lion', nome: 'King' }, | |
{ especie: 'Whale', nome: 'Fail' } | |
]; | |
for (var i = 0; i < animais.length; i++) { | |
(function(i) { | |
this.print = function() { | |
console.log('#' + i + ' ' + this.especie | |
+ ': ' + this.nome); |
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 Produto(nome, preco){ | |
this.nome = nome; | |
this.preco = preco; | |
if(preco < 0){ | |
throw RangeError('Cannot create product ' + this.nome + ' with a negative price'); | |
} | |
return this; | |
} | |
function Prato(nome, preco){ |
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
//exemplo pouco prático porém demonstrativo | |
function MyObject(name, message){ | |
this.name = name.toString(); | |
this.message = message.toString(); | |
this.getName = function(){ | |
return this.name; | |
}; | |
this.getMessage = function(){ | |
return this.message; | |
}; |
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
#define LED_VERMELHO 13 | |
#define LED_AMARELO 12 | |
#define LED_VERDE 11 | |
#define LED_VERMELHO_ 8 | |
#define LED_AMARELO_ 9 | |
#define LED_VERDE_ 10 | |
void setup(){ | |
pinMode(LED_VERMELHO, OUTPUT); |
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
server { listen 80; | |
server_name example.com; | |
access_log /var/log/example.com/nginx.access.log; | |
error_log /var/log/example.com/nginx.error.log; | |
root /var/www/apps/example.com/public; | |
charset utf-8; | |
location / { | |
rewrite ^ https://$host$request_uri? permanent; | |
} |
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
//Lista Apenas um array de objetos; | |
var users = [ | |
{name: "John Doe", age: 42} | |
, {name: "Mary Doe", age: 37} | |
, {name: "Eddie Doe", age: 24} | |
]; | |
//Ordenação Utilize a função Array#sort; | |
var ordered = users.sort(function(a, b){ | |
return (a.name < b.name ? -1 : 1); |
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
/* $cordovaCamera | |
* http://ngcordova.com/docs/plugins/camera/ | |
*/ | |
$scope.takepicture = function() { | |
var options = { | |
destinationType: Camera.DestinationType.FILE_URL, | |
quality: 90 | |
}; | |
$cordovaCamera.getPicture(options).then(function(imageData) { |
NewerOlder