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
/* 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); |
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 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; |
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
@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; |
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
{ | |
"event" : { | |
".read": true, | |
".write": true, | |
"2017": { | |
".indexOn": ["run_id", "date"] | |
} | |
} | |
} |
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
{ | |
"event": { | |
"2017": [{ | |
"title": "Seoul International Marathon", | |
"host": "Donga Ilbo", | |
"email": "kumf3040@naver.com", | |
"date": "2017/03/19 08:00", | |
"phone": "02-2652-3040", | |
"race": { | |
"0": "10km", |
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 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 |
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
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 | |
""" |
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
from rest_framework import serializers | |
from .models import Restaurant | |
class RestaurantSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Restaurant | |
fields = ('id', 'name', 'description', 'image') |
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
from django.db import models | |
class Restaurant(models.Model): | |
name = models.CharField(max_length=200) | |
description = models.TextField(blank=True) | |
image = models.ImageField(upload_to="restaurants/images/", null=True, blank=True) | |
def __str__(self): | |
return "{}".format(self.name) |
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
platform :ios, '9.0' | |
target 'TestPodsVersion' do | |
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
pod 'ObjectMapper', '~> 2.2' | |
pod 'RxSwift', '~> 3.0' | |
pod 'Moya/RxSwift' | |
pod 'Moya-ObjectMapper/RxSwift' |