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.aldajo92.androidthingsnearby | |
import android.app.Activity | |
import android.os.Bundle | |
import android.util.Log | |
import com.example.aldajo92.androidthingsnearby.BuildConfig.NEARBY_SERVICE_ID | |
import com.google.android.gms.common.ConnectionResult | |
import com.google.android.gms.common.api.GoogleApiClient | |
import com.google.android.gms.nearby.Nearby | |
import com.google.android.gms.nearby.connection.* |
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
.retryWhen(this@CheckoutViewModel::processRetry) | |
private fun processRetry(error: Observable<Throwable>): Observable<Observable<Long>>? { | |
return error.filter { isServerTimeOut(it) } | |
.zipWith(Observable.range(1, 2), BiFunction<Throwable, Int, Observable<Long>> { _, _ -> | |
hasRetried = true | |
Observable.timer(2, TimeUnit.SECONDS) | |
}) | |
} |
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
#include <Wire.h> | |
#include <Adafruit_PWMServoDriver.h> | |
// https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library | |
// called this way, it uses the default address 0x40 | |
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); | |
#define ESCMIN 150 | |
#define ESCMAX 600 | |
#define SERVOMIN 250 |
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
def smallest_positive(in_list): | |
# TODO: Define a control structure that finds the smallest positive | |
# number in in_list and returns the correct smallest number. | |
smallest = None | |
missing_positive = True | |
for val in in_list: | |
if val > 0 and smallest is not None: | |
if val < smallest: |
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
# This exercise uses a data structure that stores Udacity course information. | |
# The data structure format is: | |
# { <semester>: { <class>: { <property>: <value>, ... }, | |
# ... }, | |
# ... } | |
courses = { | |
'spring2020': { 'cs101': {'name': 'Building a Search Engine', |
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
def create_linked_list(input_list): | |
""" | |
Function to create a linked list | |
@param input_list: a list of integers | |
@return: head node of the linked list | |
""" | |
head = None | |
current_node = None | |
head_created = False | |
for value in input_list: |
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
#include <stdio.h> | |
char getCharValue(unsigned char byte) { | |
char result = 0; | |
if (byte >= 0 && byte < 10) { | |
result = 48 + byte; | |
} else if (byte >= 10 && byte <= 15) { | |
result = 65 + (byte - 10); | |
} | |
return result; |
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
import android.widget.ImageView | |
import com.squareup.picasso.Picasso | |
// add dependency | |
// implementation 'com.squareup.picasso:picasso:2.5.0' | |
fun ImageView.setImageFromUrl(url: String) { | |
Picasso.with(this.context).load(url).into(this) | |
} |
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
int main() | |
{ | |
} |
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
/****************************************************************************** | |
Referencias: | |
- Conversor para floats a binarios: https://www.h-schmidt.net/FloatConverter/IEEE754.html | |
- Conversor de enteros a binarios: http://www.binaryconvert.com/ | |
Escriba una función en Lenguaje C que reciba un vector con 32 números enteros (representando los 32 bits del | |
formato float) y devuelva un valor entero cuyo significado es el siguiente: | |
- retornar 1 si es cero | |
- retornar 2 si es positivo y menor que 1 en magnitud | |
- retornar 3 si es negativo y menor que 1 en magnitud |