Skip to content

Instantly share code, notes, and snippets.

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

sebastian tellez gorrotowi

🏠
Working from home
View GitHub Profile
// Ultrasonic - Library for HR-SC04 Ultrasonic Ranging Module.
// Rev.4 (06/2012)
// J.Rodrigo ( www.jra.so )
// more info at www.ardublog.com
#include <Ultrasonic.h>
Ultrasonic ultrasonic(12,11); // (Trig PIN,Echo PIN)
void setup() {
@gorrotowi
gorrotowi / ItemList.java
Last active July 12, 2016 18:27
List Custom Android
public class ItemList {
String title, subtitle;
int img;
public ItemList(String title, String subtitle, int img) {
this.title = title;
this.subtitle = subtitle;
this.img = img;
}
@gorrotowi
gorrotowi / ItemGrid.java
Last active July 12, 2016 18:27
Grid Custom Android
package com.gorrotowi.listandgrid;
public class ItemGrid {
String title;
int img;
public ItemGrid(String title, int img) {
this.title = title;
this.img = img;
@gorrotowi
gorrotowi / volley timeout request
Created October 23, 2015 17:49
Android Volley Retry Policy timeout
jsonRequest.setRetryPolicy(new DefaultRetryPolicy(12000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
rq.add(jsonRequest);
@gorrotowi
gorrotowi / validations.java
Last active November 24, 2015 22:40
Validation mail in java
private final static Pattern EMAIL_ADDRESS_PATTERN = Pattern
.compile(/*"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@"
+ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
+ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
+ "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$"*/
"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}");
public static boolean isMail(String email) {
package com.gorrotowi.btsendreceive;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
@gorrotowi
gorrotowi / uppercaseString.swift
Created July 12, 2016 18:26
This script converts all the first letter of a string to capitalized
func _Dash(text:String) -> String {
var modifiedText = ""
let textArr = text.componentsSeparatedByString(" ")
var repleacetxt = ""
for word in textArr {
if word != "" {
let character = word[word.startIndex]
let scalar = String(character).unicodeScalars
let unicode = scalar[scalar.startIndex].value
if unicode >= 97 && unicode <= 122 {
@gorrotowi
gorrotowi / index.html
Created July 26, 2016 06:03
No sidebar
<!DOCTYPE html>
<html>
<head>
<title>Cumpleaños</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css" integrity="sha384-XXXXXXXX" crossorigin="anonymous">
<script src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js" integrity="sha384-XXXXXXXX" crossorigin="anonymous"></script>
<link href="assets/css/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="assets/css/estilo.css" >
<meta charset="UTF-8">
@gorrotowi
gorrotowi / encodexzing.java
Created August 19, 2016 02:11
Encode data with Android XZing
//Global Objects and variables
ImageView imgBarcode;
private static final int WHITE = 0xFFFFFFFF;
private static final int BLACK = 0xFF000000;
Bitmap bmp;
//Implementation
bmp = encodeAsBitmap("1234567890", BarcodeFormat.CODE_128, 800, 200);
imgBarcode.setImageBitmap(bmp);
@gorrotowi
gorrotowi / startnewstackactivity.java
Created August 22, 2016 13:15
How to clear activity stack
Intent intent = new Intent(theContextClass.this, YourClass.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();