Skip to content

Instantly share code, notes, and snippets.

Samuel Barbosa sambarboza

Block or report user

Report or block sambarboza

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am sambarboza on github.
  • I am sambarboza (https://keybase.io/sambarboza) on keybase.
  • I have a public key ASDz-MOsY-hCxB7wavEIQCtz2CD4E28dDq4ubx6HMz-7wAo

To claim this, I am signing this object:

View Activate PTC on Android Device
#! /bin/sh
adb shell input tap 270 668
sleep .3
adb shell input tap 280 532
sleep .2
adb shell input text "$1"
sleep 1
adb shell input tap 280 50
adb shell input tap 280 50
adb shell input tap 280 50
View ModelsTest.js
'use strict';
/**
* controller test
*/
angular.module('inOutDeliveryAdmin.test', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/test', {
templateUrl: 'test/test.html',
controller: 'TestCtrl'
})
@sambarboza
sambarboza / Car.kt
Last active Jan 12, 2016
Car class using ParseDelegate
View Car.kt
@ParseClassName("Car")
class Car : ParseObject() {
var brand by ParseDelegate<String?>()
var image by ParseDelegate<ParseFile?>()
}
View Car.kt
@ParseClassName("Car")
class Car : ParseObject() {
var brand: String?
get() {
return this.getString("car")
}
set(value) {
this.put("car", value)
}
View ParseDelegate.kt
package com.sambarboza
import com.parse.ParseObject
import kotlin.reflect.KProperty
public class ParseDelegate<T> {
@Suppress("UNCHECKED_CAST")
operator fun getValue(parseObj: ParseObject, propertyMetadata: KProperty<*>): T {
return parseObj.get(propertyMetadata.name) as T
}
View AddressComponent.java
import com.google.gson.annotations.SerializedName;
public class AddressComponent {
@SerializedName("long_name")
private String longName;
@SerializedName("short_name")
private String shortName;
private String[] types;
View Android Starter Gradle Build File
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
@sambarboza
sambarboza / ParseDelegate.kt
Created Jun 3, 2015
Accessing ParseObject properties in a easy way using Kotlin Data Class and Delegate.
View ParseDelegate.kt
//Define your sublclass of ParseObject
ParseClassName("Person")
public data class Person : ParseObject() {
var name: String by ParseDelegate<String>()
var age: Int by ParseDelegate<Int>()
var avatar: ParseFile by ParseDelegate<ParseFile>()
}
//Define ParseDelegate
public class ParseDelegate<T> {
View Relative Date formatting
public class DateUtils {
private long secondMillis = 1000,
minuteMillis = 60 * secondMillis,
hourMillis = 60 * minuteMillis,
dayMillis = 24 * hourMillis;
public String getRelativeTime(Date from, Date to) {
long fromMillis = from.getTime();
long toMillis = to.getTime();
You can’t perform that action at this time.