Skip to content

Instantly share code, notes, and snippets.

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

Martin Bove mbove77

🏠
Working from home
View GitHub Profile
@mbove77
mbove77 / BubbleSortLoop.kt
Created July 20, 2022 22:56
Bubble sort implemented with loops in kotlin
fun bubbleSortLoop(inputArray: Array<Int>): Array<Int> {
var iterations = 1
var isSorted: Boolean
for (i in 0 until inputArray.size -1) {
isSorted = true
// This print is for see the interactions in sort algorithm
println("Iteration number: ${iterations++}")
for (j in 0 until inputArray.size -i -1) {
if (inputArray[j] > inputArray[j+1]) {
@mbove77
mbove77 / BubbleSortRecursion.kt
Last active July 20, 2022 23:15
Bubble sort with recursion implemented in kotlin
fun bubbleSort(inputArray: Array<Int>, nextIterIndex: Int = inputArray.size): Array<Int> {
// This print is for see the interactions in sort algorithm
println("iteration number ${inputArray.size - nextIterIndex+1}")
val lastIndex = nextIterIndex -1
var isSorted = true
for (i in 0 until lastIndex) {
val currentItem = inputArray[i]
val nextItem = inputArray[i+1]
@mbove77
mbove77 / optimizeAndCropImage.cloudFunction.js
Created August 21, 2018 18:21
Firebase cloud function to resize and optimize image after upload in cloud storage.
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const spawn = require('child-process-promise').spawn;
const mkdirp = require('mkdirp-promise');
const path = require('path');
const os = require('os');
const fs = require('fs');
// // Create and Deploy Your First Cloud Functions
exports.optimizeImages= functions.storage.object().onFinalize((data) => {
@naufraghi
naufraghi / MyImageView.java
Created December 15, 2012 15:38
Move and zoom image with Gestures in and android View
package com.develer.circularsliderule;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;