Skip to content

Instantly share code, notes, and snippets.

View hassanabidpk's full-sized avatar
🎯
Focusing

Hassan Abid hassanabidpk

🎯
Focusing
  • Singapore
View GitHub Profile
private void initiateRestaurantApi(String place, String query,final View recyclerView) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
SearchRestaurantApi api = retrofit.create(SearchRestaurantApi.class);
Call<SearchRestaurantResponse[]> call = api.getRestaurantsList("json",place,query);
progessBar.setVisibility(View.VISIBLE);
call.enqueue(new Callback<SearchRestaurantResponse[]>() {
package co.searchrestaurant.android.app.fetch;
import java.util.List;
/**
* Created by hassanabid on 2/27/16.
*/
public class SearchRestaurantResponse {
public String status;
@hassanabidpk
hassanabidpk / SearchRestaurantApi.java
Created August 1, 2017 06:59
For Medium Blog post
package co.searchrestaurant.android.app.fetch;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* Created by hassanabid on 2/27/16.
*/
public interface SearchRestaurantApi {

Remove existing version sudo apt-get -y remove nodejs*

Install new version curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -

Install Bluetooth modules

sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev

/* Create new object at /user-runs/$userid/$runid and at
* /runs/$runid simultaneously
*/
String key = mDatabase.child("runs").push().getKey();
MyRun run = new MyRun(userId, mCity, mDate, mHost, mTitle, mWeather, mWebsite, mLat,
mLng, mLocation, mMapUrl, mTemperature, "strava", activity, photo_url);
Map<String, Object> postValues = run.toMap();
Map<String, Object> childUpdates = new HashMap<>();
childUpdates.put("/runs/" + key, postValues);
public class PastEventFragment extends Fragment {
private static final String TAG = PastEventFragment.class.getSimpleName();
public static final String MARATHON_EVENT_DATABASE = "event";
private DatabaseReference mDatabase;
private List<Event> mEventList;
private Query mEventsQuery;
private Context mContext;
@hassanabidpk
hassanabidpk / Event.java
Created June 11, 2017 14:16
For firebase medium blog
@IgnoreExtraProperties
public class Event {
public String application_period;
public String city;
public String date;
public String email;
public String host;
public String latitude;
public String location;
{
"event" : {
".read": true,
".write": true,
"2017": {
".indexOn": ["run_id", "date"]
}
}
}
{
"event": {
"2017": [{
"title": "Seoul International Marathon",
"host": "Donga Ilbo",
"email": "[email protected]",
"date": "2017/03/19 08:00",
"phone": "02-2652-3040",
"race": {
"0": "10km",
import UIKit
import Alamofire
class NewRestaurantViewController: UIViewController {
static let REST_UPLOAD_API_URL = "YOUR_POST_REQUEST_URL"
override func viewDidLoad() {
super.viewDidLoad()
// If you have any autorization headers