Skip to content

Instantly share code, notes, and snippets.

View andre487's full-sized avatar
🎠
My horse is amazing

Andrey Prokopyuk andre487

🎠
My horse is amazing
View GitHub Profile
@andre487
andre487 / improve-bash-readline.sh
Last active January 8, 2024 07:59
Improve Bash readline behaviour when there is completion needed
bind 'set completion-query-items 500'
bind 'set page-completions Off'
bind 'set colored-completion-prefix On'
bind 'set colored-stats On'
bind 'set completion-ignore-case On'
bind 'set enable-keypad On'
bind 'set show-all-if-ambiguous On'
bind 'TAB:menu-complete'
class MasterSlave(Model):
# There should be only one Updater in polling mode, so we have to check that via this model
collection = 'master_slave'
ttl = 10
holder_thread = None
@classmethod
def ensure_indexes(cls):
cls.get_collection().create_index([
('created', pymongo.DESCENDING),
@andre487
andre487 / index.js
Created March 26, 2020 12:51
Chunked page example
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.setHeader('Transfer-Encoding', 'chunked');
res.write(`
<!doctype html>
<head>
@andre487
andre487 / vote.js
Created March 24, 2020 15:12
Velocity Voting
const weights = {
fcp: 2,
fmp: 5,
js: 3,
tti: 1
}
const negativeWeights = {
fcp: 3,
fmp: 6,
@andre487
andre487 / index.html
Created March 23, 2020 15:58
FMP interval
<script>
requestAnimationFrame(() => {
sendCounter('low-fmp-border')
requestAnimationFrame(() => {
sendCounter('high-fmp-border')
})
})
</script>
<div id="main">Main content</div>
@andre487
andre487 / shri-2016-appendix.md
Created August 9, 2016 17:50
Дополнительные материалы к лекциям "Инфраструктура веб-проектов" и "Инструменты разработки мобильного фронтенда"
@andre487
andre487 / shri-2016-infra-homework.md
Last active August 6, 2016 18:42
Инструкция для выполнения домашней работы по инфраструктуре, Мобилизация 2016

Инструкция для выполнения домашней работы по инфраструктуре, Мобилизация 2016

Здесь приведены шаги для выполнения задания с использованием стандартных компонент. Любые из них можно заменить аналогами

  • GitHub
    • Создать репозиторий своего приложения
  • Приложение
    • Можно использовать любое Node.js приложение, можно даже самое простое
    • Приложение должно писать логи. К примеру, построение страницы можно окружить console.time('render'), console.timeEnd('render')
  • Есть пример приложения, где можно посмотреть, как что настроено. Его использование в своём задании не будет считаться зазорным
@andre487
andre487 / empty-pocket-rules.md
Created January 7, 2016 09:43
How to reach an empty list in Pocket app
  1. You should think before adding an article. You really need to read it? Which profit it brings to your Knowledge?
  2. You should periodically remove some articles using the question from the first step.
  3. Links to pages that contains sophisticated manuals or books is not about Pocket. They are tasks, they should be moved to task or TODO tracker (I use TargetProcess for my tasks)
@andre487
andre487 / ramda-promises.js
Created September 8, 2015 10:29
Ramda promises
var Fs = require('fs');
var Http = require('q-io/http');
var Q = require('q');
var R = require('ramda');
var readFile = R.composeP(R.toString, R.partial(Q.ninvoke, Fs, 'readFile'));
var readPackageInfo = R.composeP(JSON.parse, readFile, R.partial(Q, 'package.json'));
var homePageFromAuthor = R.compose(R.propOr('', 1), R.match(/.+?\((.+?)\)$/), R.prop('author'));
@andre487
andre487 / .eslintrc
Last active August 29, 2015 16:46
Mocha bootstrap
{
"env": {"mocha": true},
"globals": {
"assert": false,
"sinon": false,
"chai": false
}
}