Skip to content

Instantly share code, notes, and snippets.

View hassanabidpk's full-sized avatar
🎯
Focusing

Hassan Abid hassanabidpk

🎯
Focusing
  • Singapore
View GitHub Profile
@hassanabidpk
hassanabidpk / views.py
Last active April 6, 2017 06:40
views.py for Medium blog post
from .serializers import RestaurantSerializer
from rest_framework import status, permissions
from rest_framework import mixins, generics
class RestaurantList(mixins.ListModelMixin,
mixins.CreateModelMixin,
generics.GenericAPIView):
"""
List all restaurant, or create a restaurant
"""
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
{
"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",
{
"event" : {
".read": true,
".write": true,
"2017": {
".indexOn": ["run_id", "date"]
}
}
}
@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;
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;
/* 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);

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

@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 {
package co.searchrestaurant.android.app.fetch;
import java.util.List;
/**
* Created by hassanabid on 2/27/16.
*/
public class SearchRestaurantResponse {
public String status;