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
# 로그이 필요 데코레이터 | |
# REST API에 오류철 핸들러 데코레이터 | |
@decorators.ajax_error_response_v2 | |
@decorators.ajax_login_required_v2 | |
def notifications(request): | |
data = {} | |
user = request.user | |
# 파라메터에 따라 몇 가지 동작을 지원함 | |
if request.method == 'GET': | |
# count 파라메터는 곧바로 뱃지 갯수 가져오기 |
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 urlparse import urlsplit, urlunsplit | |
from django import template | |
from django.http import QueryDict | |
register = template.Library() | |
@register.simple_tag | |
def url_add_query(url, **kwargs): | |
""" |
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
Date.prototype.clone = function () { | |
return new Date(this.getTime()); | |
}; | |
Date.prototype.add = function (val, unit) { | |
d = new Date(this.getTime()); | |
switch (unit) { | |
case 'year': | |
case 'years': | |
d.setYear(d.getYear() + val); |
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
function getScriptPath(filename) { | |
var scripts = document.getElementsByTagName('script'); | |
if (scripts && scripts.length > 0) { | |
for (var i in scripts) { | |
if (scripts[i].src && scripts[i].src.match(new RegExp(filename+'\\.js$'))) { | |
return scripts[i].src.replace(new RegExp('(.*)'+filename+'\\.js$'), '$1'); | |
} | |
} | |
} | |
}; |
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
#!/usr/bin/python | |
import sys,getopt | |
def str_or(s1,s2): | |
# convert strings to a list of character pair tuples | |
# go through each tuple, converting them to ASCII code (ord) | |
# perform or on the ASCII code | |
# then convert the result back to ASCII (chr) | |
# merge the resulting array of characters as a string |
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
// | |
// UIView.swift | |
// AirKlass | |
// | |
// Created by TENMA on 2016. 5. 19.. | |
// Copyright © 2016년 Quriously. All rights reserved. | |
// | |
import UIKit |