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
| class FileReader { | |
| static func getContent(ofFileName fileName:String, withExtension type: String = "json") -> Data? { | |
| let bundle = Bundle.main | |
| guard let pathOfFile = bundle.path(forResource: fileName, ofType: type) else { | |
| print("[FILE][ERROR] Cannot find file for path : \(fileName).\(type)") | |
| return nil | |
| } | |
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
| # Created by https://www.toptal.com/developers/gitignore/api/swiftpackagemanager,swift,xcode,macos | |
| # Edit at https://www.toptal.com/developers/gitignore?templates=swiftpackagemanager,swift,xcode,macos | |
| ### macOS ### | |
| # General | |
| .DS_Store | |
| .AppleDouble | |
| .LSOverride |
- Go to google search and search for what you want
- Press alt+command+I to open developer tools
- In the developer tools select network tab
- In the file types select “img”
- Refresh the page
- In the filter box write “images?q=”
- Scroll down to the bottom to get as many pictures as you like
- On the “Name” pane right click an image
- Expand Copy
- Select Copy All as cURL
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
| class RegisterDialogFragment : DialogFragment() { | |
| var onPositiveClick: ((userName: String) -> Unit)? = null | |
| var onNegativeClick: (() -> Unit)? = null | |
| override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
| val editText = EditText(context) | |
| editText.inputType = InputType.TYPE_CLASS_TEXT | |
| return with(AlertDialog.Builder(context)) { | |
| setView(editText) |
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
| import android.content.ContentValues; | |
| import android.database.Cursor; | |
| import android.database.sqlite.SQLiteDatabase; | |
| import android.util.Log; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class UserTable { |
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
| import android.content.Context; | |
| import android.database.Cursor; | |
| import android.database.sqlite.SQLiteDatabase; | |
| import android.database.sqlite.SQLiteOpenHelper; | |
| import android.util.Log; | |
| public class DatabaseHelper extends SQLiteOpenHelper { | |
| public static final int DATABASE_VERSION = 8; //version en prod : 6 // version pre brand: 7 // add brand to shoppingProduct: 8 | |
| private static final String TAG = "DatabaseHelper"; |
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
| implementation 'joda-time:joda-time:2.10.5' | |
| //Navigation | |
| def nav_version = "2.2.0" | |
| implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" | |
| implementation "androidx.navigation:navigation-ui-ktx:$nav_version" | |
| // coroutines for getting off the UI thread | |
| def coroutines = "1.0.1" |
Connecting to a brick with PAN
- Assign an IP Address to the PAN connection type you want (USB, Bluetooth, Wifi)
IP : 192.168.1.2
NetMask: 255.255.255.0
- In MacOS go to Network and search for the Pan connection
- Enter the same Network mask and a different IP for your Mac on the Brick network
Le refactoring c'est repasser sur son code pour le rendre bien plus robuste, simple à lire et standard.
C'est la qu'est l'intelligence du développeur, on différenciera le bon développeur du "mec qui suit les tuto sur openclassroom" avec ce genre de connaissance.
Du code pris sur un projet, qui est vraiment pas mauvais :
/**
* Get the data from the elastic search and convert the GeoNamesPlace to a Place