Skip to content

Instantly share code, notes, and snippets.

View hassanabidpk's full-sized avatar
🎯
Focusing

Hassan Abid hassanabidpk

🎯
Focusing
  • Singapore
View GitHub Profile
#!/bin/bash
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@hassanabidpk
hassanabidpk / ios_open_source.md
Last active November 27, 2016 07:07
Popular iOS open source libraries (Swift)
[
{
"model": "mapaplace.tag",
"pk": 1,
"fields": {
"title": "\ud55c\uad6d\uc5b4",
"slug": "\ud55c\uad6d\uc5b4"
}
},
{
@hassanabidpk
hassanabidpk / azure_db_settings.py
Last active December 17, 2016 18:05
For djangocupcakeshop project
if DEBUG:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'cupcakeshop_db_local',
'USER': 'admincupcake',
'PASSWORD': '*****',
'HOST': 'cupcakeshop.database.windows.net',
'PORT': '1433',
'OPTIONS': {
@hassanabidpk
hassanabidpk / settings.py
Last active January 2, 2017 06:51
For allowed hosts
ALLOWED_HOSTS = ['adelar.pytonanywhere.com']
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'
@hassanabidpk
hassanabidpk / models.py
Created April 6, 2017 05:47
For Medium blog post
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)
@hassanabidpk
hassanabidpk / serializers.py
Created April 6, 2017 06:21
Serializer for Medium blog post
from rest_framework import serializers
from .models import Restaurant
class RestaurantSerializer(serializers.ModelSerializer):
class Meta:
model = Restaurant
fields = ('id', 'name', 'description', 'image')
@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
"""