Skip to content

Instantly share code, notes, and snippets.

View itkr's full-sized avatar
:octocat:

Shota Itakura itkr

:octocat:
View GitHub Profile
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
var format = function(){
var i = 0;
var str = "";
for(i = 0; i < arguments.length; i++){
str = str + arguments[i];
}
return str;
};
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;
}
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