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
<?php | |
// @param $c int шанс выйгрыша | |
function _randc($c){ | |
mt_srand(crc32(microtime())); | |
return (mt_rand(0, 100) < $c); | |
} | |
// test avg random | |
function random_c($c=50){ | |
$win = 0; $fail = 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
.outer { | |
position: fixed; | |
top: calc(50% - 300px / 2); | |
background: red; | |
width: 300px; | |
display: flex; | |
height: 300px; | |
left: calc(50% - 300px / 2); | |
z-index: 10; | |
vertical-align: middle; |
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
String.prototype.toHHMMSS = function () { | |
var sec_num = parseInt(this, 10); // don't forget the second param | |
var hours = Math.floor(sec_num / 3600); | |
var minutes = Math.floor((sec_num - (hours * 3600)) / 60); | |
var seconds = sec_num - (hours * 3600) - (minutes * 60); | |
if (hours < 10) {hours = "0"+hours;} | |
if (minutes < 10) {minutes = "0"+minutes;} | |
if (seconds < 10) {seconds = "0"+seconds;} | |
return hours+':'+minutes+':'+seconds; |
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
<?php | |
/* | |
@param array массив для перемешивания | |
@param int семя случайных чисел | |
*/ | |
function seededShuffle(array &$array, $seed) { | |
mt_srand($seed); | |
$size = count($array); | |
for ($i = 0; $i < $size; ++$i) { | |
list($chunk) = array_splice($array, mt_rand(0, $size-1), 1); |
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
<?php | |
/* | |
Класс работы с токенами подтверждений данных | |
@author [email protected] | |
CREATE TABLE `confirm_data` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`token` varchar(32) NOT NULL, | |
`expire_time` int(11) NOT NULL, |
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
/* http://stackoverflow.com/a/4407335/3479278 */ | |
.noselect { | |
-webkit-touch-callout: none; /* iOS Safari */ | |
-webkit-user-select: none; /* Chrome/Safari/Opera */ | |
-khtml-user-select: none; /* Konqueror */ | |
-moz-user-select: none; /* Firefox */ | |
-ms-user-select: none; /* Internet Explorer/Edge */ | |
user-select: none; /* Non-prefixed version, currently | |
not supported by any browser */ |
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
<?php | |
/* | |
$id (int) номер игры / ни на что не влияет | |
$min (int) минимальное значение рандома | |
$max (int) максимальное | |
$api (uuid) апи ключ | |
@return (array) массив данных ответа | |
*/ |
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
<?php | |
/* | |
@author Dmitriy Nyashkin | |
*/ | |
$folder_path="static/"; // путь куда ложить картинки | |
$folder_public_url="https://localhost/static/"; // путь на который заменить | |
function download_file($url, $folder, $filename){ |
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 | |
# -*- coding: utf-8 -*- | |
# influxdata metric function | |
import requests, time | |
METRIC_URL = "http://0.0.0.0:8086/" | |
def metric(database, collection='metrics', tags={}, values={}): | |
url = '' |
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
/*//////////////////////////////////////// | |
// Spacing | |
///////////////////////////////////////*/ | |
/* Padding Zero */ | |
.p0{padding: 0} | |
/* Padding Top */ | |
.pt0{padding-top:0} | |
.pt10{padding-top:10px} | |
.pt15{padding-top:15px} | |
.pt20{padding-top:20px} |