Skip to content

Instantly share code, notes, and snippets.

View zgfif's full-sized avatar
🙃

Pasha Bratanov zgfif

🙃
  • Odesa, Ukraine
View GitHub Profile
@zgfif
zgfif / Configuration Neovim by using init.lua on Windows 11
Last active November 13, 2024 16:21
How to configure Neovim for Windows 11 by using init.lua
1. Create file init.lua in C:\Users\your_name\AppData\Local\nvim\init.lua
2. Add to file init.lua parameters for tabs (for Python I use 4 spaces for identation):
vim.cmd("set expandtab")
vim.cmd("set tabstop=4")
vim.cmd("set softtabstop=4")
vim.cmd("set shiftwidth=4")
3. Add to init.lua configuration for lazy.nvim package manager
https://lazy.folke.io/installation
@zgfif
zgfif / init.vim
Last active November 11, 2024 21:12
neovim configuration for Windows 11
set number
set relativenumber
call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'preservim/nerdtree'
Plug 'ryanoasis/vim-devicons'
require 'active_model'
class Superhero
include ActiveModel::Validations
@@total = []
attr_reader :name, :age
def initialize name, age
@name = name
class Arsenal
def self.hello
'Hello as class method!'
end
def mymy
'Arsen Wenger'
end
@zgfif
zgfif / superhero.rb
Last active December 29, 2018 20:57
require 'active_model'
class Superhero
include ActiveModel::Validations
attr_accessor :name, :age
def initialize **args
@name = args[:name]
@zgfif
zgfif / act_as.rb
Last active December 28, 2018 21:14
module ActsAsWalker
attr_reader :distance
def walk!
@distance += 1
end
end
module ActsAsSpeaker
attr_reader :speak, :gills
ar = [1, 2, 4]
def square_values array
array.map! {|e| e * e }
end
p square_values ar
def summarize *args
"#{args[0]} #{args[1]} #{args[2]}"
end
p summarize 1,2,3,4,5
def hello_message options = {}
first_name = options.fetch :first_name
last_name = options.fetch :last_name
"Hello, #{first_name} #{last_name}"
end
data = {first_name: 'Lero4ka', last_name: 'Melnik' }
# p hello_message data
require 'active_model'
class Person
include ActiveModel::Validations
attr_accessor :name, :age, :size
def initialize name: nil, age: nil, size: nil
@name = name
@age = age