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
| request.session.set_expiry(0) |
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 re | |
| re.subn(r'<.+>','','fdsfdsfs32<fdsfsf>1321f<fdsf/a>dsfvds') |
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
| # coding=utf-8 | |
| """ | |
| jQuery templates use constructs like: | |
| {{if condition}} print something{{/if}} | |
| This, of course, completely screws up Django templates, | |
| because Django thinks {{ and }} mean something. | |
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 oss.oss_api import * | |
| ID='fdsfdsf' | |
| KEY='fdsfdsfsfdd' | |
| oss=OssAPI(access_id=ID,secret_access_key=KEY) | |
| # res=oss.get_bucket_acl('headimg2') | |
| # print res.status,res.read() | |
| res=oss.put_object_from_file('headimg','your.jpg','1.jpg') | |
| print res.status,res.read() |
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
| // 定义updateTitle指令 | |
| app.directive('updateTitle', function($rootScope, $timeout) { | |
| return { | |
| link: function(scope, element) { | |
| var listener = function(event, toState, toParams, fromState, fromParams) { | |
| var title = 'Default Title'; | |
| if (toState.data && toState.data.pageTitle) title = toState.data.pageTitle; | |
| // Set asynchronously so page changes before title does | |
| $timeout(function() { |
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
| #--example 1-- | |
| from django.dispatch import Signal | |
| login_signal=Signal() | |
| def login_func(**kwargs): | |
| print 'login_func' | |
| login_signal.send(sender='login_func', **kwargs) | |
| def login_handler1(sender,**kwargs): | |
| print 'someone login' |
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
| # Definition for singly-linked list. | |
| # class ListNode(object): | |
| # def __init__(self, x): | |
| # self.val = x | |
| # self.next = None | |
| def addtwoNode(node1,node2,step): | |
| if node1 is None: | |
| node1_val = 0 | |
| else: | |
| node1_val = node1.val |
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 Solution(object): | |
| def lengthOfLongestSubstring(self, s): | |
| """ | |
| :type s: str | |
| :rtype: int | |
| """ | |
| resstring = '' | |
| cache = '' | |
| for i in s: | |
| if i not in cache: |
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 Solution(object): | |
| def findMedianSortedArrays(self, nums1, nums2): | |
| """ | |
| :type nums1: List[int] | |
| :type nums2: List[int] | |
| :rtype: float | |
| """ | |
| nums = nums1 + nums2 | |
| nums = sorted(nums) | |
| total = len(nums) |
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
| def selectorder(thelist): | |
| for index,num in enumerate(thelist): | |
| minnum = num | |
| minnum_index = index | |
| for index2,num2 in enumerate(thelist[index+1:]): | |
| if num2 < minnum: | |
| minnum = num2 | |
| minnum_index = index + index2 + 1 | |
| thelist[index] = minnum |