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
| # 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
| #--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
| // 定义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
| 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
| # 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
| 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
| request.session.set_expiry(0) |
This file has been truncated, but you can view the full file.
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
| #!/usr/bin/env python | |
| # | |
| # Hi There! | |
| # You may be wondering what this giant blob of binary data here is, you might | |
| # even be worried that we're up to something nefarious (good for you for being | |
| # paranoid!). This is a base64 encoding of a zip file, this zip file contains | |
| # an entire copy of pip. | |
| # | |
| # Pip is a thing that installs packages, pip itself is a package that someone | |
| # might want to install, especially if they're looking to run this get-pip.py |
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
| #!python | |
| """Bootstrap distribute installation | |
| If you want to use setuptools in your package's setup.py, just include this | |
| file in the same directory with it, and add this to the top of your setup.py:: | |
| from distribute_setup import use_setuptools | |
| use_setuptools() | |
| If you want to require a specific version of setuptools, set a download |