Skip to content

Instantly share code, notes, and snippets.

View jmarkstar's full-sized avatar
🏠
Working from home

Marco Estrella jmarkstar

🏠
Working from home
View GitHub Profile
@tinmegali
tinmegali / AppDatabse.kt
Last active January 12, 2023 13:44
Android Room @TypeConverter using Kotlin
@Database(entities = arrayOf(Note::class, User::class), version = 1)
@TypeConverters(Converters::class)
abstract class AppDatabse : RoomDatabase() {
abstract fun userDAO(): UserDAO
abstract fun noteDAO(): NoteDAO
}
@DejanEnspyra
DejanEnspyra / multipart.swift
Created July 2, 2017 07:55
Alamofire 4 — Multipart file upload with Swift 3 (http://theappspace.com/multipart-file-upload/)
func requestWith(endUrl: String, imageData: Data?, parameters: [String : Any], onCompletion: ((JSON?) -> Void)? = nil, onError: ((Error?) -> Void)? = nil){
let url = "http://google.com" /* your API url */
let headers: HTTPHeaders = [
/* "Authorization": "your_access_token", in case you need authorization header */
"Content-type": "multipart/form-data"
]
Alamofire.upload(multipartFormData: { (multipartFormData) in
@trilliwon
trilliwon / uiimage-data.swift
Last active January 12, 2024 14:45
Swift UIImage to Data, Data to UIImage
// Swift4
let image = UIImage(named: "sample")
let data = image?.pngData()
let data = image?.jpegData(compressionQuality: 0.9)
let uiImage: UIImage = UIImage(data: imageData)
// deprecated
// var imageData: Data = UIImagePNGRepresentation(image)
@ansell
ansell / install-java.sh
Last active April 20, 2024 01:36
Ubuntu 18.04-Mint 18 installations for Java Maven Eclipse Kotlin Gradle
#!/bin/sh
# Install Java-8
#sudo add-apt-repository ppa:webupd8team/java -y
#sudo apt-get update
#echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
#echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
#sudo apt-get install oracle-java8-installer oracle-java9-installer oracle-java9-set-default
sudo apt-get install openjdk-8-jdk