Skip to content

Instantly share code, notes, and snippets.

View dimanyc's full-sized avatar

Dimitry Nazarov dimanyc

View GitHub Profile
@dimanyc
dimanyc / gist:22924e3e08829ebcfb63c9997b487832
Created May 24, 2023 23:24
rucksack problem for materials
class Item:
def __init__(self, width, height, quantity):
self.width = width
self.height = height
self.quantity = quantity
class MaterialSheet:
def __init__(self, width, height):
self.width = width
self.height = height
@dimanyc
dimanyc / .vimrc
Created September 8, 2021 14:20
.vimrc 09/08/21
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'danilo-augusto/vim-afterglow'
Plug 'thoughtbot/vim-rspec'
Plug 'tomasr/molokai'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dispatch'
@dimanyc
dimanyc / .vimrc
Last active June 19, 2020 13:36
.vimrc as of 5/17/20
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/plugged')
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'danilo-augusto/vim-afterglow'
Plug 'dense-analysis/ale'
Plug 'jparise/vim-graphql'
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|tmp\|coverage'
@dimanyc
dimanyc / .vimrc
Created December 28, 2018 15:50
new vimrc
set nocompatible " be iMproved, required
filetype off " required
"--- Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
map <Leader>t :call RunCurrentSpecFile()<CR>
@dimanyc
dimanyc / array_refinement.rb
Created June 7, 2017 05:04
MemberUniqualizer Array Refinement
module MemberUniquelizer
refine Array do
# makes each member within an array
# unique by appending a unique number
def uniquelize(ary = self)
ary.map { |member| format_member(member) }
.flatten
.uniq
@dimanyc
dimanyc / node.rb
Created June 7, 2017 05:01
Node class
### Node Class
using MemberUniquelizer
class Node < HashWithIndifferentAccess
attr_reader :id
# constructs a new hash based on injected
# headers and attributes
def self.from_rows(headers, attributes)
headers = uniqualize_headers(headers)
@dimanyc
dimanyc / gist:fd9568f4b58991c5b255a0d18adfd3d8
Created September 2, 2016 22:17 — forked from metaskills/gist:4065702
Example Of Other/Legacy DB Connection Management & Query Cache
# Assuming you champioin your other DB connection with a class.
module OtherDb
class Connection < ActiveRecord::Base
establish_connection :other_db
self.abstract_class = true
end
end
# Alway use the connection for other/legacy connections.
set -g default-terminal "screen-256color"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
# Use vim keybindings in copy mode
setw -g mode-keys vi
bind [ copy-mode
XTerm*faceName: Bitstream Vera Serif Mono
xterm*faceSize: 13
xterm*vt100*geometry: 80x60
xterm*saveLines: 16384
xterm*VT100.Translations: #override \
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD)
# update Xterm config: