Skip to content

Instantly share code, notes, and snippets.

View dan085's full-sized avatar

Daniel dan085

  • Chile
  • 09:46 (UTC -03:00)
View GitHub Profile
/ back 버튼 여백 적용 메소드
extension UIImage {
func imageWithInsets(insets: UIEdgeInsets) -> UIImage {
UIGraphicsBeginImageContextWithOptions(
CGSize(width: self.size.width + insets.left + insets.right,
height: self.size.height + insets.top + insets.bottom),
false, self.scale)
guard UIGraphicsGetCurrentContext() != nil else { return UIImage() }
let origin = CGPoint(x: insets.left, y: insets.top)
self.draw(at: origin)
@dan085
dan085 / compareDateTime.kt
Last active February 16, 2020 02:44
comparador de fecha con kotlin
import java.util.*
import java.util.concurrent.TimeUnit
fun main() {
println("Hello, world!!!")
compareDateTime()
}
@dan085
dan085 / gist:c04133f4654f891ebc38b7ddfcbca558
Created February 1, 2020 21:06
seleccionar foto de la galerya o usar la camara
import android.content.BroadcastReceiver
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.net.Uri
import android.os.Build
import android.os.Parcelable
import android.os.StrictMode
import android.provider.MediaStore
implementation fileTree(dir: 'libs', include: ['*.jar'])
//implementation(name: 'libBioMini_v20', ext: 'aar')
implementation files('libs/telpo_api.jar')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
@dan085
dan085 / gist:ffdb492290f0c0eeed7bf03531eac664
Last active January 14, 2020 14:52
Librería ion para subir archivos al servidor
Ion.with(ctx.applicationContext)
.load(AppConfig.URL_IMAGE)
.setTimeout(15000)
// .setHeader("Authorization", "b7 " + chatService.get_token())
.uploadProgress { downloaded, total ->
println("$downloaded / $total")
val percentage2 = (0.5 + downloaded.toDouble() / total.toDouble() * 100).toInt()
println(percentage2)
//progressbar_picture.setProgress(percentage2);
}
@dan085
dan085 / compare_list.kt
Created October 17, 2019 01:50
Compare kotlin two list array.. update delete or update
fun main() {
//// usuarios del celular registrados
val sync_list_name_mobile = ArrayList<HashMap<String, String>>()
val contactMap_initial = HashMap<String, String>()
contactMap_initial.put("KEY_NAME", "PEDRO")
contactMap_initial.put("mobile", "1111")
@dan085
dan085 / EndlessRecyclerOnScrollListener.java
Last active September 8, 2019 04:04 — forked from justluvher/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener for pagination b7
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
private int visibleThreshold = 5;
// The current offset index of data you have loaded
private int currentPage = 0;
// The total number of items in the dataset after the last load
private int previousTotalItemCount = 0;
@dan085
dan085 / P12toPEM.txt
Created December 9, 2018 23:15 — forked from shahdhiren/P12toPEM.txt
Convert P12 file for Push Notification to PEM format
Development Phase:
Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
Step 3: Optional (If you want to remove pass phrase asked in second step)
Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
@dan085
dan085 / build.gradle
Created September 21, 2018 20:02 — forked from ph0b/build.gradle
sample build.gradle for generating split APKs per ABI
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig{
minSdkVersion 14
targetSdkVersion 21
versionCode 101
@dan085
dan085 / upload_demo_html.html
Created July 10, 2018 02:01 — forked from paambaati/upload_demo_html.html
Uploading files using NodeJS and Express 4
<html>
<body>
<form action="/upload" enctype="multipart/form-data" method="post">
<input type="text" name="title">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html>