Skip to content

Instantly share code, notes, and snippets.

View denpatin's full-sized avatar
🐷
己亥

Den Patin denpatin

🐷
己亥
View GitHub Profile
@denpatin
denpatin / all_increasing_subsequences.rb
Last active February 11, 2017 12:23
Finding all increasing subsequences in Ruby
class Array
def powersets
inject([[]]){ |ps, el| ps + ps.map{ |e| e + [el] } }
end
def increasing?
each_with_index do |el, i|
break if i == size - 1
return false unless el < self[i + 1]
end
@denpatin
denpatin / t-salary.md
Last active January 5, 2017 20:24
Расчёт по выплатам зарплаты в T-Systems RUS
Оклад «Чистыми» Аванс Зарплата В час В день В час В месяц
20 000 ₽ 17 400 ₽ 6 000 ₽ 11 400 ₽ 98 ₽ 790 ₽ $1,63 $290
30 000 ₽ 26 100 ₽ 9 000 ₽ 17 100 ₽ 148 ₽ 1 186 ₽ $2,47 $435
40 000 ₽ 34 800 ₽ 12 000 ₽ 22 800 ₽ 197 ₽ 1 581 ₽ $3,28 $580
50 000 ₽ 43 500 ₽ 15 000 ₽ 28 500 ₽ 247 ₽ 1 977 ₽ $4,12 $725
60 000 ₽ 52 200 ₽ 18 000 ₽ 34 200 ₽ 296 ₽ 2 372 ₽ $4,93 $870
70 000 ₽ 60 900 ₽ 21 000 ₽ 39 900 ₽ 346 ₽ 2 768 ₽ $5,77 $1 015
80 000 ₽ 69 600 ₽ 24 000 ₽ 45 600 ₽ 395 ₽ 3 163 ₽ $6,58 $1 160
85 000 ₽ 73 950 ₽ 25 500 ₽ 48 450 ₽ 420 ₽ 3 361 ₽ $7,00 $1 232
@denpatin
denpatin / README.md
Last active August 29, 2018 13:59
Dynamic select of images by themes

Описание файлов

Предусловия

  • В папке app/assets/images/pictures должны лежать картинки.
  • В базе в таблицах images и themes должны быть данные. В поле file таблицы images должны быть названия файлов картинок.
  • В файле config/initializers/assets.rb должна быть строчка: Rails.application.config.assets.paths << Rails.root.join('assets', 'images', 'pictures')

works_controller.rb

@denpatin
denpatin / yogadi-yomgir.md
Created October 26, 2016 13:46
Benom — Yog'adi yomg'ir

Yog'adi yomg'ir / Ёғади ёмғир

Oʻzbek tili Ўзбек тили
Mazmunsiz bu kunlar, maqsadsiz orzular, Мазмунсиз бу кунлар, мақсадсиз орзулар,
Yuragimni ezar, sendan qolgan dog'lar. Юрагимни эзар, сендан қолган доғлар.
Negadir sen mendan, ojiz bu sevgimdan, Негадир сен мендан, ожиз бу севгимдан,
Ketgansan sababsiz. Кетгансан сабабсиз.
@denpatin
denpatin / kyrgyz.html
Last active September 20, 2016 12:08
Грамматический очерк кыргызского языка (Абдувалиев) https://rawgit.com/denpatin/a3d31684aacae69922fcec233d72ea61/raw/3badee36a8e4face11eede29bfa023ff52133e3c/kyrgyz.html
<h1>Кыргызский язык</h1>
<body>
<div class="main-content">
<div class="col-md-8 col-sm-12 col-lg-9">
<br>
<div class="page-header">
<h2>Гласные</h2>
</div>
<div>
li $t0, 0x10010000
addiu $t1, $t0, 0x100
li $t2, 0
li $t3, 1
Square:
sw $t2, ($t0)
addiu $t0, $t0, 4
add $t2, $t2, $t3
addiu $t3, $t3, 2
bne $t0, $t1, Square
@denpatin
denpatin / pyramid.rb
Created March 13, 2016 17:02
Ruby implementation of a pyramid with a custom height
#
# Input: Pyramid's height
# Output: Pyramid with given height and width = height * 2 - 1
#
MAX_HEIGHT = 20
prompt = 'Enter pyramid\'s height: '
puts prompt
while height = gets.chomp
@denpatin
denpatin / progressbar.rb
Created March 6, 2016 10:40
Showing progress bar for each-ish methods
=begin
Usage examples:
big_array.each_with_progress(){ |e| ... }
(0...1000000).each_with_progress(){ |i| ... }
big_hash.each_key_with_progress(){ |k| ... }
@denpatin
denpatin / genre-definition.tex
Last active January 30, 2016 19:07
Simplified genre-definition formula from master thesis
A = \| a_{ij} \|, i = 1, \dotsc, j = 1, \dotsc, 4,
A_i = ( a_{i1}, a_{i2}, a_{i3}, a_{i4} ),
M_k = \{ m_{ik} = | a_{ik} - a_{i1} | : m_{ik} = \min_{j=2, \dotsc, 4}( |a_{ij} - a_{i1}| ), i = 1, \ldots\},
P_k = \frac{ card(M_k) }{ \sum\limits_{k=2}^{4} card(M_k) }
@denpatin
denpatin / make.sh
Created January 21, 2016 09:04 — forked from artzub/make.sh
Install JetBrains Hub + YouTrack + UpSource + Nginx
#!/bin/bash
apt-get install mc htop git unzip wget curl -y
echo
echo "====================================================="
echo " WELCOME"
echo "====================================================="
echo
echo "Hub"