Skip to content

Instantly share code, notes, and snippets.

View Borodin's full-sized avatar
📷
http://tour-360.ru

Maxim Borodin Borodin

📷
http://tour-360.ru
View GitHub Profile
@Borodin
Borodin / index.js
Last active December 13, 2015 19:58 — forked from jankuca/index.js
var stdout = process.stdout;
var info = console.info;
var warn = console.warn;
var error = console.error;
var DEFAULT = "\033[m";
var BLUE = "\033[1;36m";
var YELLOW = "\033[1;33m";
var RED = "\033[1;31m";
{"Data":[{"QuestionId":25600,"OneAnswer":102536},{"QuestionId":25623,"OneAnswer":102656},{"QuestionId":25587,"OneAnswer":102473},{"QuestionId":39869,"OneAnswer":156609},{"QuestionId":39895,"OneAnswer":156717},{"QuestionId":39854,"OneAnswer":156535},{"QuestionId":39822,"ManyAnswers":[156400,156401,156402]},{"QuestionId":25632,"OneAnswer":102705},{"QuestionId":39853,"OneAnswer":156530},{"QuestionId":39821,"OneAnswer":156397},{"QuestionId":25644,"OneAnswer":102762},{"QuestionId":25677,"OneAnswer":102926},{"QuestionId":39800,"OneAnswer":156288},{"QuestionId":39871,"OneAnswer":156616},{"QuestionId":25586,"OneAnswer":102468},{"QuestionId":25635,"OneAnswer":102722},{"QuestionId":25664,"OneAnswer":102855},{"QuestionId":39897,"OneAnswer":156724},{"QuestionId":39837,"OneAnswer":156464},{"QuestionId":25657,"OneAnswer":102818}]}
@Borodin
Borodin / upload_file.html
Last active November 2, 2023 01:05
Upload file javascript
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload</title>
</head>
<body>
<?php
if($_FILES['image']['tmp_name']){
@Borodin
Borodin / captha.php
Last active December 27, 2015 06:19
<?
header('Content-Type: image/jpeg');
$im = imagecreatetruecolor(175, 60);
imagefill($im, 0, 0, imagecolorallocate($im, 240, 240, 240));
for($i=0; $i<5; $i++)imagettftext($im, 16, 0, 10+30*$i, 40, imagecolorallocate($im, 100, 100, 100), 'arial.ttf', rand(0, 9));
imagepng($im);
imagedestroy($im);
//imagecreatetruecolor(width, height)
//imagefill(image, x, y, color);
var a = [30, 48, 20, 30]; // Запасы
var b = [18, 27, 42, 26, 15]; // Заявки
var n = [
[ 13, 7, 14, 7, 5],
[ 11, 8, 12, 6, 8], //Затраты на доставку
[ 6, 10, 10, 8, 11],
[ 14, 8, 10, 10, 15]
];
<?php
header('Content-Type: text/html; charset=utf-8');
$mbox = imap_open("{server143/notls}INBOX.Sent", 'login', 'pass') or die("can't connect: " . imap_last_error());;
$total_count = imap_num_msg($mbox);
function header_decode($str){
$header = imap_mime_header_decode(imap_utf8($str));
return ($header[0]->charset=='default')? $header[0]->text : iconv($header[0]->charset, 'UTF-8', $header[0]->text);
}
@Borodin
Borodin / DSM.js
Last active August 29, 2015 14:00
var feeds = [
[1, 3, 1, 2], // Жиры, белки, углеводы, нитраты первого корма
[3, 1, 8, 4], // Второго корма
[2, 5, 8, 1] // Третья корма
]
var rate = [6, 9, 8, 16]; // Количество необходимых веществ
var cost = [800, 10, 45]; // Цена первого и виторого корма
/*========================[ Решение ]===========================*/
@Borodin
Borodin / iframe.html
Last active August 29, 2015 14:06
Tour-360.ru iframe code
<iframe src="http://tour-360.ru/projects/anticafemsk/?id=0&lon=-89.20&lat=-3.60&fov=70.00&autorotation=true" width="640" height="480" frameborder="no" scrolling="no" allowfullscreen></iframe>
<br><a href="http://tour-360.ru"><br><a href="http://tour-360.ru">Профессиональная съемка 3D панорам и создание виртуальных туров 360º</a>
@Borodin
Borodin / gist:8846366206c8987fbc84
Last active August 29, 2015 14:21
getDistance
var rad = function(x) {
return x * Math.PI / 180;
};
var getDistance = function(lat1, lng1, lat2, lng2) {
var R = 6378137;
var d_lat = rad(lat2 - lat1);
var d_lng = rad(lng2 - lng1);
var a = Math.sin(d_lat / 2) * Math.sin(d_lat / 2) +
Math.cos(rad(lat1)) * Math.cos(rad(lat2)) *