Skip to content

Instantly share code, notes, and snippets.

View tzangms's full-sized avatar

tzangms tzangms

View GitHub Profile
@tzangms
tzangms / drf_pagination_example.py
Created January 7, 2016 07:06
DRF pagination example
@detail_route()
def posts(self, request, pk=None):
"""
Photos of current user
"""
user = self.get_object()
photos = Photo.objects.filter(user=user)
queryset = self.paginate_queryset(photos)

Keybase proof

I hereby claim:

  • I am tzangms on github.
  • I am tzangms (https://keybase.io/tzangms) on keybase.
  • I have a public key whose fingerprint is 599D 62E0 EF68 B7EA DA68 4C9D 0CCB 4456 9C3B BCF1

To claim this, I am signing this object:

@tzangms
tzangms / feed.html
Created July 30, 2019 15:05
podcast feed
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
{% if podcast.new_feed_url %}<itunes:new-feed-url>{{ podcast.new_feed_url }}</itunes:new-feed-url>{% endif %}
<atom:link href="http://{{ request.get_host }}{{ podcast.get_absolute_url }}rss/" rel="self" type="application/rss+xml" />
<title><![CDATA[{{ podcast.title|striptags|fix_ampersands }}]]></title>
<link>http://{{ request.get_host }}{{ podcast.get_absolute_url }}</link>
<description><![CDATA[{{ podcast.description|striptags|fix_ampersands }}]]></description>
<language>zh-TW</language>
@tzangms
tzangms / plupload.js
Created November 21, 2022 08:50
plupload example
$(function() {
var uploader = new plupload.Uploader({
runtimes : 'flash,html5,silverlight,html4',
url : plupload_url,
browse_button : 'pickfiles',
container : 'plupload_container',
max_file_size : '150mb',
chunk_size: '1mb',
multipart: true,
unique_names : true,