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
// eg: Twelve(29) => [1,1,1,0,1] | |
function Twelve($num) | |
{ | |
$num = (int)$num; | |
$result = []; | |
if ($num == 2) { | |
$result = [0, 1]; | |
} else { | |
while ($num>2) { | |
$result[]=$num%2; |
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
Timestamp2Date: function(time) { | |
if (time != null) { | |
var date = new Date(time * 1000); | |
Y = date.getFullYear() + '-'; | |
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; | |
D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '; | |
h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'; | |
m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()); | |
time = Y + M + D + h + m | |
} |
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
# eg: Twelve(29) => [1,1,1,0,1] | |
def Twelve(self,num): | |
result = [] | |
while num>2: | |
result.append(num%2) | |
num = math.floor(num/2) | |
result.append(num%2) | |
return result[::-1] | |
# eg: Lists2StringTen([1,1,1,0,1]) => 29 |
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
https://press.one/p/v?s=f8f917459148e6350eb7770ab1a0cb78e6dbc1356c91848516c730b243303da14d3289398bb5b7715798a9e9d5e6696a2335fd8f1fb5b1510d1a760d3103762501&h=f622ed331c30f283e0fab18c9cfe0d68820d71bea63a7103534749843c513c29&a=07a92581f6b2007739f1c7ac1fad63d6acf04244&hash_alg=sha256&f=P1&v=3 |
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
https://press.one/p/v?s=f8f917459148e6350eb7770ab1a0cb78e6dbc1356c91848516c730b243303da14d3289398bb5b7715798a9e9d5e6696a2335fd8f1fb5b1510d1a760d3103762501&h=f622ed331c30f283e0fab18c9cfe0d68820d71bea63a7103534749843c513c29&a=07a92581f6b2007739f1c7ac1fad63d6acf04244&hash_alg=sha256&f=P1&v=3 |
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
https://press.one/p/v?s=f8f917459148e6350eb7770ab1a0cb78e6dbc1356c91848516c730b243303da14d3289398bb5b7715798a9e9d5e6696a2335fd8f1fb5b1510d1a760d3103762501&h=f622ed331c30f283e0fab18c9cfe0d68820d71bea63a7103534749843c513c29&a=07a92581f6b2007739f1c7ac1fad63d6acf04244&hash_alg=sha256&f=P1&v=3 |