Skip to content

Instantly share code, notes, and snippets.

View kinlane's full-sized avatar

Kin Lane kinlane

View GitHub Profile
@kinlane
kinlane / citygrid-places-api-class.php
Created December 28, 2011 04:43
CityGrid Places API
<?php
class citygridplaces {
private $publishercode;
private $dbserver;
private $dbname;
private $dbuser;
private $dbpassword;
public function __construct($publishercode) {
@kinlane
kinlane / citygrid-adsvertising-api-class.php
Created December 28, 2011 04:46
CityGrid Advertising API
<?php
class citygridads {
private $publishercode;
private $dbserver;
private $dbname;
private $dbuser;
private $dbpassword;
public function __construct($publishercode) {
@kinlane
kinlane / citygrid-api-places-api-search-sample.php
Created December 28, 2011 04:48
CityGrid API Places API - Search Sample
<?php
include "citygrid-api-class.php";
$publishercode = "[your publisher code]";
$placement=null;
$has_offers=false;
$histograms=false;
$i=null;
$format='json';
@kinlane
kinlane / citygrid-api-places-api-detail-sample.php
Created December 28, 2011 04:49
CityGrid API Places API - Detail Sample
<?php
include "citygrid-api-class.php";
$publishercode = "[your publisher code]";
$phone=null;
$customer_only=null;
$placement = null;
$all_results=null;
$review_count=null;
@kinlane
kinlane / class-citygrid-places-api.py
Created December 31, 2011 08:57
CityGrid Places API
class citygridplaces(object):
def srchplaceswhere(self,what,type,where,page,rpp,sort,rformat,placement,hasoffers,histograms,i,publishercode):
qStr = {'publisher':publishercode, 'sort':sort, 'page':page, 'rpp':rpp}
url = "http://api.citygridmedia.com/content/places/v2/search/where?"
if len(what) > 0:
qStr['what'] = what
@kinlane
kinlane / class-citygrid-ad-api.py
Created December 31, 2011 08:58
CityGrid Advertising API
class citygridadvertising(object):
def displaywebad300x250(self,adid,publisher,what,where):
returnAd = '<div id="sidebar_ad_slot_' + adid + '"></div>\r'
returnAd += '<script type="text/javascript">\r'
returnAd += "new CityGrid.Ads('sidebar_ad_slot_" + adid + "', {\r"
returnAd += " collection_id: 'web-002-300x250',\r"
returnAd += " publisher: '" + publisher + "',\r"
returnAd += " what:'" + what + "',\r"
@kinlane
kinlane / citygrid-api-places-api-search-sample.py
Created December 31, 2011 09:02
CityGrid API Places API - Search Sample
#include "class-citygrid-places-api.py"
what = escape(unquote(str(req.__getattribute__('args'))))
what = what.replace("amp;", ""); #why does this need to happen?
querystring = dict(item.split("=") for item in what.split("&"))
# what
try:
what = querystring['what']
except:
@kinlane
kinlane / citygrid-api-places-api-detail-sample.py
Created December 31, 2011 09:08
CityGrid API Places API - Detail Sample
#include "class-citygrid-places-api.py"
args = escape(unquote(str(req.__getattribute__('args'))))
qString = args.replace("amp;", ""); #why does this need to happen?
querystring = dict(item.split("=") for item in qString.split("&"))
id = querystring['id']
what = querystring['what']
where = querystring['where']
@kinlane
kinlane / class-citygrid-places-api.rhtml
Created January 16, 2012 07:15
CityGrid Places API - Ruby Class
<%
class CityGridPlaces
def initialize()
end
def srchplaceswhere(what,type,where,page,rpp,sort,rformat,placement,hasoffers,histograms,i,publishercode)
@rooturl = "http://api.citygridmedia.com/content/places/v2/search/where?"
@kinlane
kinlane / class-citygrid-ad-api.rhtml
Created January 16, 2012 07:15
CityGrid Advertising API - Ruby Class
<%
class CityGridAdvertising
def initialize()
end
def displaywebad300x250(adid,publisher,what,where)
@returnAd = '<div id="sidebar_ad_slot_' + adid + '"></div>' + "\n"