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 authentication | |
from rest_framework import exceptions | |
from apps.newspaper.models import Subscriber | |
class AccessKeyAuthentication(authentication.BaseAuthentication): | |
def authenticate(self, request): | |
access_key = request.GET.get("access_key", None) | |
if not access_key: |
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 bottle import Bottle,response | |
def allow_cors(func): | |
""" this is a decorator which enable CORS for specified endpoint """ | |
def wrapper(*args, **kwargs): | |
response.headers['Access-Control-Allow-Origin'] = 'example.com' # * in case you want to be accessed via any website | |
return func(*args, **kwargs) | |
return wrapper | |
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
<?php | |
require_once 'googleplaces.class.php'; | |
$googlePlaces = new GooglePlaces(array( | |
'apiKey' => "YOUR_API_KEY" | |
)); | |
$query['query'] = "Burger in Berlin"; | |
$places = $googlePlaces->getLocationsByTextSearch($query); | |
$decoded_data = json_decode($places, true); |
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 nltk | |
import random | |
class Categorizer(object): | |
def __init__(self, categories): | |
self.categories = categories | |
def prep_seed(self, content): | |
"""Convert seed content into nltk.Text""" | |
raw = nltk.clean_html(content) |
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 os | |
import sys | |
from getpass import getpass | |
import gdata.docs.service | |
import gdata.spreadsheet.service | |
''' | |
get user information from the command line argument and |
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 java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
/** | |
* | |
* @author mushfiq | |
*/ | |
public class JSDateTOJavaDateConversion { |
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
node_modules/* | |
*.data |
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
node_modules/* |
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 requests | |
from BeautifulSoup import BeautifulSoup | |
class crawlPyCentral(object): | |
def __init__(self, url='http://pythoncentral.org/'): | |
self.url = url | |
def getSoup(self): | |
response = requests.get(self.url) |
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
db.$cmd.sys.unlock.findOne(); |