Skip to content

Instantly share code, notes, and snippets.

⚛️
Writing React components.

Douglas Nassif Roma Junior douglasjunior

⚛️
Writing React components.
Block or report user

Report or block douglasjunior

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 BluetoothWriter.swift
import Foundation
import CoreBluetooth
class BluetoothWriter : NSObject {
private weak var peripheral: CBPeripheral!;
private weak var characteristic: CBCharacteristic!;
init(peripheral : CBPeripheral, characteristic:CBCharacteristic) {
self.peripheral = peripheral;
@douglasjunior
douglasjunior / BluetoothWriter.h
Last active Aug 29, 2015
Exemplo de código Objective-C
View BluetoothWriter.h
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
@interface BluetoothWriter : NSObject
-(id) initWithPeripheral:(CBPeripheral *) peripheral characteristic:(CBCharacteristic *)characteristic;
- (void) writeString:(NSString *) value;
- (void) writeData:(NSData *) value;
-(void) writeColorWithRed:(int)red withGreen:(int)green withBlue:(int)blue;
@douglasjunior
douglasjunior / CustomAndroidApplication.java
Created Sep 8, 2015
Fix 24hours for android-validation-komensky
View CustomAndroidApplication.java
import android.app.Application;
import eu.inmite.android.lib.validations.form.validators.ValidatorFactory;
/**
* Created by douglas on 06/08/15.
*/
public class CustomAndroidApplication extends Application {
static {
// register the custom validator
@douglasjunior
douglasjunior / AbstractAdapter.java
Last active Sep 10, 2015
Exemplo de uso do Adapter com RecyclerView
View AbstractAdapter.java
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import java.util.ArrayList;
import java.util.List;
@douglasjunior
douglasjunior / BodyEditorLoader.java
Last active Oct 5, 2015
Fix for JsonParser problem.
View BodyEditorLoader.java
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.JsonReader;
import com.badlogic.gdx.utils.JsonValue;
import com.badlogic.gdx.utils.OrderedMap;
@douglasjunior
douglasjunior / JsonChildSerializer.java
Last active Oct 8, 2015
Implementação de JsonSerializer para evitar recursividade. Somente o ID dos objetos filhos é serializado.
View JsonChildSerializer.java
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
/**
* Implementação do JsonSerializar customizado para adicionar somente o ID do objeto filho.
*
* Created by douglas on 02/02/15.
@douglasjunior
douglasjunior / Codigo.java
Last active Nov 4, 2015
Exemplo de ID com Auto-incremento utilizando Realm Database
View Codigo.java
/**
* Entidade que irá armazenar sempre o último código de cada entidade na base de dados Realm.
*
* Created by douglas on 06/08/15.
*/
public class Codigo extends RealmObject {
@PrimaryKey
private String classe;
@douglasjunior
douglasjunior / ProgressRequestBody.java
Created Feb 19, 2016
Class used to monitoring the file upload progress in Retrofit2 library.
View ProgressRequestBody.java
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okio.BufferedSink;
@douglasjunior
douglasjunior / Connectivity.java
Created Sep 12, 2016 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
View Connectivity.java
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
View AsyncTask.swift
//
// AsyncTask.swift
//
// Created by Douglas Nassif Roma Junior on 08/06/15.
// Copyright (c) 2015 Douglas Nassif Roma Junior. All rights reserved.
//
import Foundation
class AsyncTask<Params, Progress, Result> : NSObject {
You can’t perform that action at this time.