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
| // | |
| bool starts_with(const std::string & str, const std::string & sub, bool ignore_case=false) | |
| { | |
| int str_len = str.size(); | |
| int sub_len = sub.size(); | |
| if (str_len < sub_len) return false; | |
| if (ignore_case) | |
| { |
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
| // set url params | |
| // if params not exists in url, then add params | |
| // if params exists in url, then replace | |
| function setUrlParams(url, params) { | |
| var parts = url.split("?"); | |
| var path = parts[0] | |
| var old_params = {}; | |
| if (parts.length == 1); | |
| else { | |
| var items = parts[1].split("&"); |
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 LogEntryAdmin(admin.ModelAdmin): | |
| list_display = ('action_time', 'user', 'object_repr', 'action_flag') | |
| list_per_page = 20 | |
| list_display_links = None | |
| search_fields = ['=user__username', ] | |
| fieldsets = [(None, {'fields': ()}), ] | |
| def has_add_permission(self, request): | |
| return False |
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 IfRegexNode(Node): | |
| def __init__(self, var1, var2, nodelist_true, nodelist_false, negate): | |
| self.var1, self.var2 = Variable(var1), Variable(var2) | |
| self.nodelist_true, self.nodelist_false = nodelist_true, nodelist_false | |
| self.negate = negate | |
| def __repr__(self): | |
| return "<IfRegexNode>" | |
| def render(self, context): |
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
| USES_CONVERSION; | |
| A2CT(str); | |
| CT2A(str); |
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
| void EnableDlgItem (CWnd *dlg, int items[], BOOL bEnable) | |
| { | |
| int i = 0, item ; | |
| while ((item = items[i++]) != 0) | |
| { | |
| CWnd *pControl = dlg->GetDlgItem(item) ; | |
| if (pControl != NULL) | |
| pControl->EnableWindow(bEnable) ; | |
| } |
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
| sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ | |
| phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/ | |
| electron_mirror=https://npm.taobao.org/mirrors/electron/ | |
| registry=https://registry.npm.taobao.org |
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
| import datetime | |
| from django.conf import settings | |
| from rest_framework.authentication import TokenAuthentication | |
| from rest_framework import exceptions | |
| from django.utils.translation import ugettext_lazy as _ | |
| from django.core.cache import cache | |
| EXPIRE_MINUTES = getattr(settings, 'REST_FRAMEWORK_TOKEN_EXPIRE_MINUTES', 1) |
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
| #include <sys/time.h> | |
| /** | |
| * Returns the current time in microseconds. | |
| */ | |
| long getMicrotime(){ | |
| struct timeval currentTime; | |
| gettimeofday(¤tTime, NULL); | |
| return currentTime.tv_sec * (int)1e6 + currentTime.tv_usec; | |
| } |
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
| int width = m_view_size.width(); | |
| int height = m_view_size.height(); | |
| uint8_t * data = new uint8_t[width * height * 4]; | |
| m_gles2->ReadPixels(m_context->pp_resource(), 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); | |
| cv::Mat rgbFrame, outputFrame; | |
| cv::Mat glFrame = cv::Mat(height, width, CV_8UC4, data); | |
| cv::cvtColor(glFrame, rgbFrame, CV_BGRA2RGB); | |
| cv::flip(rgbFrame, outputFrame, 0); |