Skip to content

Instantly share code, notes, and snippets.

View kalashnikovisme's full-sized avatar
💜
Look at my readme

Pavel Kalashnikov kalashnikovisme

💜
Look at my readme
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kalashnikovisme on github.
  • I am kalashnikovisme (https://keybase.io/kalashnikovisme) on keybase.
  • I have a public key ASDVeoOQspk0G4ZJMgzCFFTzbG7M6OUpGzazXbVdfiCExgo

To claim this, I am signing this object:

@kalashnikovisme
kalashnikovisme / main.md
Created May 12, 2021 07:33
Test Ruby MIddle (russian)

Github Open API wrapper gem

Требуется создать гем, который позволяет использовать некоторые фичи Github Open API.

Гем должен иметь реализацию в себе следующих запросов:

Функции гема должны возвращать Ruby-объекты, содержающие все полученные из JSON-ответов данные. Вызов функций должен происходить синхронный.

@kalashnikovisme
kalashnikovisme / .gitlab-ci.yml
Created March 5, 2021 22:31
docker-rubocop example
services:
- docker:19.03.5-dind
stages:
- linter
linter:
stage: linter
services:
- docker:latest
@kalashnikovisme
kalashnikovisme / script.rb
Last active February 12, 2021 02:29
Fix "json" exported from errbit
file = File.open("errors.json").read
lines = []
file.each_line do |line|
line.gsub!(/ObjectId\({1}(.)/, '\1').sub!(/()*\)/, '\1') if line.include? 'ObjectId'
line.gsub!(/ISODate\({1}(.)/, '\1').sub!(/()*\)/, '\1') if line.include? 'ISODate'
lines.push line
end
puts lines
@kalashnikovisme
kalashnikovisme / aasm.readme example.rb
Created February 4, 2021 00:57
Medium. Get list of state machines names provided by gem `aasm` article
class SimpleMultipleExample
include AASM
aasm(:move, column: 'move_state') do
state :standing, initial: true
state :walking
state :running
event :walk do
transitions from: :standing, to: :walking
end
@kalashnikovisme
kalashnikovisme / Ruby List.md
Last active November 1, 2017 14:01 — forked from evtuhovich/gist:1134998
Список вопросов для собеседования

Общие вопросы

  • динамическая и статическая типизация
  • строгая и нестрогая типизация
  • компилируемые и интерпретируемые языки

Ruby

  • принципиальное различие скриптовых и “обычных” языков
  • типизация в Ruby
  • 3 принципа ООП
  • реализация множественного наследования в ruby
  • duck typing
---
- hosts: all
vars:
name: "Your name"
email: "your_email"
tasks:
- command: git config --global user.email "{{ email }}"
- command: git config --global user.name "{{ name }}"
- apt: name={{ item }}
sudo: True
@kalashnikovisme
kalashnikovisme / resolution.sh
Last active May 25, 2016 17:19
ubuntu set screen resolution
cvt 1440 900 60
xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode VGA1 1440x900_60.00
@kalashnikovisme
kalashnikovisme / youtube_embed_auto_size.coffee
Created May 16, 2016 18:34
Youtube embed auto size (Coffeescript, jQuery)
parent_div_width = $('.youtube_embed').parents('div').first().width()
$youtube_embed = $('.youtube_embed iframe')
$youtube_embed.prop('width', "#{parent_div_width}px")
$youtube_embed.prop('height', "#{parent_div_width / 16 * 9}px")
@kalashnikovisme
kalashnikovisme / gist:7852903
Created December 8, 2013 03:06
Export DataGridView to Excel. You must have "export.xlt" file in project directory.
public void ExportToExcel(DataGridView grid) {
ApplicationClass Excel = new ApplicationClass();
XlReferenceStyle RefStyle = Excel.ReferenceStyle;
Excel.Visible = true;
Workbook wb = null;
String TemplatePath = System.Windows.Forms.Application.StartupPath + @"\export.xlt";
try {
wb = Excel.Workbooks.Add(TemplatePath); // !!!
} catch (System.Exception ex) {
throw new Exception("Template is unavailable " + TemplatePath + "\n" + ex.Message);