Skip to content

Instantly share code, notes, and snippets.

<body>
<br />
<br />
<br />
<style type='text/css'>
a.link{margin:0;padding:0;border:none !important;text-decoration:none !important;}
table,tr,td,a,span{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;}
</style>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<meta name='format-detection' content='telephone=no' />
@Mark-Shine
Mark-Shine / gist:307367f5106ea313502d
Created January 22, 2015 08:19
get user's follows and fans
def build_user_FOO(foo, serializer_class_name, query_param=None):
if foo not in ['follows', 'fans', 'order_set']:
raise AttributeError
##todo check SerializerClass
get_class = lambda x: globals()[x]
@api_view(["GET"])
@authentication_classes((TokenAuthentication, ))
def get_user_foo(request, pk):
@register.inclusion_tag("generic/includes/comments.html", takes_context=True)
def comments_for(context, obj):
"""
Provides a generic context variable name for the object that
comments are being rendered for.
"""
form = ThreadedCommentForm(context["request"], obj)
try:
context["posted_comment_form"]
except KeyError:
<?php
if (! defined ( 'IN_DISCUZ' )) {
exit ( 'Access Denied' );
}
class plugin_monitor {
}
@Mark-Shine
Mark-Shine / gist:11398865
Created April 29, 2014 12:30
install mysql and related
sudo apt-get install mysql
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
sudo pip install mysql-python
@Mark-Shine
Mark-Shine / gist:11243497
Last active April 8, 2016 08:46
Php 发送POST请求
function do_post_request($url, $data, $optional_headers = null)
{
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);