- Existem diversas discussões sobre qual deve ser o tamanho de uma função.
- Mas algo mais importante é se perguntar: "Quando devemos envolver um código na sua própria função?"
- Algumas pessoas se guiam por:
- tamanho - uma função não deve ser tão grande que não caiba na tela
- reuso - qualquer código utilizado mais de uma vez deve ser colocado em uma função, caso contrário, deve ser deixado inline
- Uma abordagem interessante é separação entre intenção e implementação.
- Se você tiver que se esforçar ao olhar um fragmento de código para entender o que ele faz, o código deve ser extraído para um função e a função nomeada.
- Quando você ler o código novamente, o propósito da função ficará explícito sem a necessidade de entender o seu funcionamento internamente.
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
// Select database | |
use database_name | |
// Create Collections | |
db.createColletction('collection_name') | |
// See collections in a database | |
show collections | |
// insert data into a collection |
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
console.log('-----\n-----'); | |
var canais = ['sbt', 'globo', 'record']; | |
canais.forEach(function(canal){ | |
canais.push('cultura'); // este item foi adicionado depois da primeira chamada dpo callback e não entrará na intereção do forEach | |
console.log(canal); | |
}); | |
// já neste a cultura foi adicionado | |
console.log('-----\n-----'); |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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
package com.example.reportcard; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
/** | |
* Created by jesse on 04/04/18. | |
* This is a part of the project ReportCard. | |
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Rx = require('rxjs'); | |
var firebase = require('firebase'); | |
firebase.initializeApp({ | |
"databaseURL": "https://quiver-two.firebaseio.com", | |
"serviceAccount": "./service-account.json" | |
}); | |
var ref = firebase.database().ref('rxjs-demo'); | |
Rx.Observable.fromPromise(ref.remove()) | |
.map(function () { |
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
package com.android.myapplication; | |
import android.content.res.Resources; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.widget.ArrayAdapter; | |
import android.widget.AutoCompleteTextView; | |
import java.util.Locale; |
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
package com.udacity.tourguide.fragments; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.AdapterView; |
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
package com.android.myapplication; | |
import android.content.Intent; | |
import android.content.res.Resources; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.ArrayAdapter; | |
import android.widget.AutoCompleteTextView; |
OlderNewer