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 random | |
| import string | |
| import hashlib | |
| source = string.digits + string.letters | |
| letters = "".join([random.choice(source) for i in xrange(25)]) | |
| letters_hash = hashlib.sha256(letters).hexdigest() | |
| print 'Letters =>', letters | |
| print 'SHA-256 =>', letters_hash |
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
| function extend(Child, Parent) { | |
| var NewParent = Parent; | |
| if(typeof Parent.prototype.parent !== "undefined"){ | |
| NewParent = Animate.tools.extend(Parent, Parent.prototype.parent); | |
| } | |
| Child.prototype = new NewParent(); | |
| Child.prototype.parent = NewParent; | |
| return Child; | |
| } |
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
| var format = function(){ | |
| var i = 0; | |
| var str = ""; | |
| for(i = 0; i < arguments.length; i++){ | |
| str = str + arguments[i]; | |
| } | |
| return 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
| local function getCenterPosition(baseNode, childNode) | |
| local baseSize = baseNode:getContentSize() | |
| local childSize = childNode:getContentSize() | |
| return baseSize.width / 2 - childSize.width / 2, | |
| baseSize.height / 2 - childSize.height / 2 | |
| end |
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
| git log --no-merges --date=short --pretty='format:%h %cd %an%d %s' master...HEAD | cat |
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
| select | |
| id, | |
| updated_at | |
| from | |
| foo_table | |
| where | |
| date(updated_at + interval 9 hour) between (current_date() - interval 3 day) and (current_date() - interval 1 day) | |
| ; |
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
| alias fd='find ./ -type f -print | xargs grep' |
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 cached_property(func): | |
| @property | |
| def f(self): | |
| name = "_{}_cache".format(func.__name__) | |
| if not hasattr(self, name): | |
| setattr(self, name, func(self)) | |
| return getattr(self, name) | |
| return f |
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
| {{datetime_object|date:'n月j日 H:i'}} |
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 datetime import datetime | |
| import time | |
| a = datetime.now() | |
| # datetime.datetime(2015, 4, 16, 16, 15, 47, 92560) | |
| b = int(time.mktime(a.timetuple())) | |
| # 1429168547 | |
| datetime.fromtimestamp(b) |
OlderNewer