This file contains hidden or 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
iPhone4,1 | |
iPhone5,1 | |
iPhone5,2 | |
iPhone5,3 | |
iPhone5,4 | |
iPhone6,1 | |
iPhone6,2 | |
iPhone7,1 | |
iPhone8,1 | |
iPhone8,2 |
This file contains hidden or 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
#!/usr/bin/env python | |
from binascii import b2a_base64 | |
import hashlib | |
import hmac | |
try: | |
from urlparse import urlparse | |
except ImportError: | |
from urllib.parse import urlparse |
This file contains hidden or 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
# get OAuth2 token | |
curl -H 'host:www.deviantart.com' -H 'User-Agent:DeviantArt/1.12 (iPhone; iOS 8.2; Scale/2.00)' -H 'Accept-Language:en;q=1' -H 'DA-SYNC-TOKEN:2fcf547f0e4ddcd8e8e45084b6dc0d2c' -H 'dA-minor-version:20160316' -H 'Accept:*/*' -H 'Content-Type:application/x-www-form-urlencoded' -H 'dA-session-id:b0618f6c2819e75b9d2b20b0e96c5802' -H 'Connection:keep-alive' -H 'Proxy-Connection:keep-alive' -H 'Content-Length:123' -H 'Accept-Encoding:gzip, deflate' -X POST 'https://www.deviantart.com/oauth2/token' --compressed --data-binary 'client_id=1701&client_secret=e6af3dc9712a1aad9efed05f16ceecf198aefcb5bab1531018e28034a3792e30&grant_type=client_credentials' |
This file contains hidden or 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
let maskLayer = CALayer() | |
let maskImage = UIImage(named: "avatar-mask")?.cgImage | |
maskLayer.frame = CGRect(x: 0, y: 0, width: profileImageView.bounds.size.width, height: profileImageView.bounds.size.height) | |
maskLayer.contents = maskImage; | |
profileImageView.layer.mask = maskLayer | |
profileImageView.layer.masksToBounds = true |
This file contains hidden or 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
{ | |
'reviews':[ | |
{ | |
'author':{ | |
'first_name':'Maryann', | |
'has_profile_pic':True, | |
'id':40613795, | |
'picture_url':'https://a0.muscache.com/im/pictures/c77f54a1-c3d0-4742-93af-f2e53b8f5145.jpg?aki_policy=profile_x_medium', | |
'smart_name':'Maryann', | |
'thumbnail_url':'https://a0.muscache.com/im/pictures/c77f54a1-c3d0-4742-93af-f2e53b8f5145.jpg?aki_policy=profile_small' |
This file contains hidden or 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 graphene import ObjectType, String, Boolean, ID, Field, Int | |
class User(ObjectType): | |
first_name = String() | |
has_profile_pic = Boolean() | |
id = ID() | |
picture_url = String() | |
smart_name = String() | |
thumbnail_url = String() |
This file contains hidden or 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 graphene import ObjectType, List | |
class Query(ObjectType): | |
reviews = List(Review, id=Int(required=True)) |
This file contains hidden or 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
# stolen from https://stackoverflow.com/questions/6578986/how-to-convert-json-data-into-a-python-object/15882054#15882054 | |
def _json_object_hook(d): | |
return namedtuple('X', d.keys())(*d.values()) | |
def json2obj(data): | |
return json.loads(data, object_hook=_json_object_hook) |
This file contains hidden or 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
class Query(ObjectType): | |
reviews = List(Review, id=Int(required=True)) | |
def resolve_reviews(self, args, context, info): | |
reviews = api_call(args.get("id"))["reviews"] | |
return json2obj(json.dumps(reviews)) |
This file contains hidden or 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 flask import Flask | |
from schema import Query | |
from flask_graphql import GraphQLView | |
from graphene import Schema | |
import os | |
view_func = GraphQLView.as_view( | |
'graphql', schema=Schema(query=Query), graphiql=True) |