This file contains 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 email | |
from email.policy import default | |
class MboxReader: | |
def __init__(self, filename): | |
self.handle = open(filename, 'rb') | |
assert self.handle.readline().startswith(b'From ') | |
def __enter__(self): |
This file contains 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
RUN apt-get install -y libwebp-dev libde265-dev autotools-dev automake pkg-config libtool wget git make gcc pkg-config autoconf g++ curl | |
RUN wget https://github.com/strukturag/libheif/archive/v1.6.2.tar.gz && \ | |
tar -xvf v1.6.2.tar.gz && \ | |
cd libheif-1.6.2/ && \ | |
./autogen.sh && \ | |
./configure && \ | |
make && \ | |
make install |
This file contains 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 * as React from 'react' | |
import validate from 'validate.js' | |
import { ValidationRules } from 'utils/validate' | |
import { findValueByPath } from 'utils/path' | |
type FieldConfiguration = { | |
key: string | |
validation?: ValidationRules | |
defaultValue?: any | |
nested?: FieldConfiguration[] |
This file contains 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
for _, e := range config.Tasks { | |
err := c.AddFunc(e.Time, func() { | |
task := e | |
out, err := exec.Command("/bin/sh", "-c", task.Command).Output() | |
if err != nil { | |
raven.CaptureErrorAndWait(err, map[string]string{"command": e.Command, "time": task.Time}) | |
log.Printf("%s: %s", e.Command, err) | |
} | |
if e.Output != nil { | |
f, err := os.OpenFile(*task.Output, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) |
This file contains 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
# Compile RoadRunner | |
FROM golang:1.11 as RoadRunner | |
RUN git clone https://github.com/spiral/roadrunner --branch v1.2.8 /app | |
WORKDIR /app | |
RUN ./build.sh Linux | |
# Build PHP image |
This file contains 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 | |
require __DIR__ . "/vendor/autoload.php"; | |
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; | |
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; | |
$relay = new Spiral\Goridge\StreamRelay(STDIN, STDOUT); | |
$psr7 = new Spiral\RoadRunner\PSR7Client(new Spiral\RoadRunner\Worker($relay)); |
This file contains 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 | |
ini_set('display_errors', 'stderr'); | |
use App\Kernel; | |
use Spiral\Goridge\StreamRelay; | |
use Spiral\RoadRunner\PSR7Client; | |
use Spiral\RoadRunner\Worker; | |
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; | |
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; | |
use Symfony\Component\Debug\Debug; |
This file contains 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 | |
/** | |
* Created by Alex Bond at UPDG. | |
* Date: 2/19/15 6:59 PM | |
*/ | |
namespace frontend\modules\store\controllers; | |
use common\models\Categories; |
This file contains 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
1. Сделать универсальный поиск по всему контенту с сайта - API, Гайд, Мануалы, Форум + как вариант сделать поиск в Stack Overflow. | |
Вот как я это вижу: | |
http://habrastorage.org/files/af5/06b/69e/af506b69e54d4002827617578e346de6.png | |
Поле можно использовать в 2 режимах: | |
Обычные вопросы При обычных вопросах система сначала должна искать ответы на часто задаваемые вопросы в отдельной таблице в базе (на скрине это ответ с знаком вопроса). Потом уже система ищет в других системах. | |
Поиск в указанном контенте Например, человек хочет найти метод API. В этом случае он может ввести in:API и получить ответы только из API Yii. | |
Данный поиск должен понимать основные языки, а не только английский. |
This file contains 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
public static String combineSplit(int startIndex, String[] string, String seperator) { | |
StringBuilder builder = new StringBuilder(); | |
if (string.length >= 1) { | |
for (int i = startIndex; i < string.length; i++) { | |
builder.append(string[i]); | |
builder.append(seperator); | |
} | |
if (builder.length() > seperator.length()) { | |
builder.deleteCharAt(builder.length() - seperator.length()); |
NewerOlder