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 / settings.py
Last active January 2, 2017 06:51
For allowed hosts
ALLOWED_HOSTS = ['adelar.pytonanywhere.com']
@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': {
[
{
"model": "mapaplace.tag",
"pk": 1,
"fields": {
"title": "\ud55c\uad6d\uc5b4",
"slug": "\ud55c\uad6d\uc5b4"
}
},
{
@hassanabidpk
hassanabidpk / ios_open_source.md
Last active November 27, 2016 07:07
Popular iOS open source libraries (Swift)
#!/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
#
from bs4 import BeautifulSoup
import requests
import re
import csv
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
let params = ["location": locationStr,"rtype": escapedRestaurantValue]
Alamofire.request(.GET, API_BASE_URL, parameters: params)
.responseJSON { response in
if let restaurants = response.result.value {
print("JSON: \(restaurants)")
if let error = restaurants["error"] {
print("No venue found | error :\(error)")
self.restaurantName.text = "Nothing found! Try again"
self.stopSpinner(nil)
return
[
{"name":"Peppes Pizza",
"latitude":"59.911342",
"longitude":"10.749586",
"address":"Karl Johans gate 1 (Jernbanetorget) 0154 Oslo Norge",
"photo_url":"https://irs0.4sqi.net/img/general/455x300/1089036_6y6hN44be6KeNqnl8hjS-OaLpV6i0bF-h_yXQJ5nzEQ.jpg",
"phone_number":"+47 22 22 55 55",
"venue_id":"4b67301bf964a52038402be3",
"checkins":1025,
"r_type":"pizza",
# required imports
def getRestaurantList(ilocation,query):
#....
# code implementation can be seen here https://github.com/hassanabidpk/searchrestaurant/blob/master/django/searchrestaurant/search/views.py
return result
class RestaurantList(APIView):
def get(self,request,format=None):
if "location" in request.GET and "rtype" in request.GET: