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 / CoffeeDetailScreen1.kt
Last active July 4, 2024 13:55
Iteration 1 of CoffeeDetailScreen generated by Google AI Studio. Iteration 2 done to rectify changes
package dev.hassanabid.ioextendedsg.studioui
import android.annotation.SuppressLint
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Coffee
import androidx.compose.material.icons.filled.DeliveryDining
@hassanabidpk
hassanabidpk / ProductDetailsScreen1.kt
Created June 30, 2024 16:19
Product Details Screen Iteration 1 and 2
package dev.hassanabid.ioextendedsg
import android.annotation.SuppressLint
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PageSize
import androidx.compose.foundation.pager.rememberPagerState
@hassanabidpk
hassanabidpk / LoginScreen.kt
Created June 30, 2024 15:29
LoginScreen created using Google AI Studio
package dev.hassanabid.ioextendedsg.studioui
import android.annotation.SuppressLint
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
@hassanabidpk
hassanabidpk / home.js
Created August 18, 2017 08:27
Pycon Lunch React Native Home Screen
import React from 'react';
import { StyleSheet, Text, FlatList, ActivityIndicator, View, Image } from 'react-native';
import { List, ListItem, SearchBar, Avatar } from "react-native-elements";
import { StackNavigator } from 'react-navigation';
export default class HomeScreen extends React.Component {
constructor(props) {
super(props);
this.state = {
@hassanabidpk
hassanabidpk / App.js
Created August 18, 2017 08:20
Pycon Lunch React Native
// @flow
import React from 'react';
import { StyleSheet, Text, FlatList, ActivityIndicator, View, Image } from 'react-native';
import { List, ListItem, SearchBar, Avatar } from "react-native-elements";
import { StackNavigator } from 'react-navigation';
import { constants } from 'expo';
import HomeScreen from './src/components/home';
import DetailScreen from './src/components/detail';
@hassanabidpk
hassanabidpk / sample.json
Created August 18, 2017 07:30
Pycon Lunch sample response
[{
"id": 3,
"name": "Newyork Pizza",
"address": "Coex mall west gate, first floor, Seoul",
"photo": "/media/food/photos/piza.jpg",
"tags": "pizza",
"menu": "1. Cheese pizza\r\n2. Vegetable Pizza\r\n3. Chicken Pizza",
"pub_date": "2017-08-05T16:34:08.094007Z"
}]
@hassanabidpk
hassanabidpk / views.py
Created August 18, 2017 07:27
Pycon Lunch Views
from django.shortcuts import render
from django.http import JsonResponse
from .models import Restaurant
from .serializers import RestaurantSerializer
from django.views.decorators.csrf import csrf_exempt
def index(request):
rest_list = Restaurant.objects.order_by('-pub_date')
context = {'rest_list': rest_list}
@hassanabidpk
hassanabidpk / serializers.py
Created August 18, 2017 07:22
Pycon Lunch serializer
from rest_framework import serializers
from food.models import Restaurant
class RestaurantSerializer(serializers.ModelSerializer):
class Meta:
model = Restaurant
fields = ('id', 'name', 'address', 'photo', 'tags', 'menu', 'pub_date')
@hassanabidpk
hassanabidpk / models.py
Created August 18, 2017 07:20
Pycon Lunch Model
from django.db import models
from django.contrib.auth.models import User
class Restaurant(models.Model):
name = models.CharField(max_length=200)
address = models.TextField()
photo = models.ImageField(upload_to="food/photos/", null=True, blank=True)
menu = models.TextField()
tags = models.CharField(max_length=200)
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[]>() {