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 <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; |
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 Foundation | |
import CoreBluetooth | |
class BluetoothWriter : NSObject { | |
private weak var peripheral: CBPeripheral!; | |
private weak var characteristic: CBCharacteristic!; | |
init(peripheral : CBPeripheral, characteristic:CBCharacteristic) { | |
self.peripheral = peripheral; |
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
// | |
// 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 { |
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
<?php | |
header('Content-Type: application/json'); | |
header('Character-Encoding: utf-8'); | |
// recebe os parâmetros | |
$QTD = (int) filter_input(INPUT_GET, 'qtd', FILTER_VALIDATE_INT); | |
$LAT = (float) filter_input(INPUT_GET, 'lat', FILTER_VALIDATE_FLOAT); | |
$LNG = (float) filter_input(INPUT_GET, 'lng', FILTER_VALIDATE_FLOAT); | |
if ($LAT && $LNG) { |
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.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; |
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.youtproject.util; | |
import android.text.Editable; | |
import android.text.TextWatcher; | |
/** | |
* Listener used to capture "on selected item" event on MaterialBetterSpinner. | |
* Created by douglas on 22/09/15. | |
*/ | |
public abstract class OnItemSelectedListener implements TextWatcher { |
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.content.Context; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import com.weiwangcn.betterspinner.library.material.MaterialBetterSpinner; | |
/** | |
* Created by Douglas Nassif Roma Junior on 30/09/15. | |
*/ | |
public class CustomMaterialSpinner extends MaterialBetterSpinner { |
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 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; |
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
public class MyActivity extends Activity { | |
public void onCreate(...){ | |
RecyclerView rv = findViewByIdCast(R.id.rv); | |
// 2 is the number of columns | |
rv.setLayoutManager(new GridLayoutManager(this, 2)); | |
// Calculates the width of the "CardView" dynamically. | |
int cardViewWidth = getResources().getDimension(R.dimen.my_cardview_width) + getResources().getDimension(R.dimen.my_cardview_margin) * 2; | |
rv.getViewTreeObserver().addOnGlobalLayoutListener(new OnFlowLayoutListener(rv, cardViewWidth)); | |
} |
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.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 |
OlderNewer