Skip to content

Instantly share code, notes, and snippets.

View thesunwave's full-sized avatar
🏠
Working from home

Artur Malev thesunwave

🏠
Working from home
View GitHub Profile
@thesunwave
thesunwave / .pryrc
Created December 18, 2020 11:10 — forked from bibendi/.pryrc
Dip on Rails
Pry.config.history.should_save = true
Pry.config.history.file = File.join(__dir__, '.pry_history')
@thesunwave
thesunwave / docker-cleanup-resources.md
Created May 21, 2019 11:49 — forked from fpapadopou/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@thesunwave
thesunwave / tmux-iterm2.md
Created November 7, 2017 14:25 — forked from royling/tmux-iterm2.md
tmux in iTerm2 cheatsheet
@thesunwave
thesunwave / rvm.sh
Last active February 14, 2017 11:14 — forked from tesths/rvm.sh
rvm
#fork from https://github.com/huacnlee/init.d
echo "Install RVM"
echo "---------------------------------------------------------------------------"
command gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
command curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install 2.3.3
@thesunwave
thesunwave / capybara cheat sheet
Created July 28, 2016 11:16 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@thesunwave
thesunwave / nested_content_snippet.rb
Created June 28, 2016 19:24 — forked from bunnymatic/nested_content_snippet.rb
nested content in rails view helpers
# because i can never remember exactly how and when to use concat
# when building content in helpers
def nested_content
content_tag 'div' do
concat(content_tag 'span', 'span block')
concat(tag 'br')
concat(link_to 'root link', root_path)
concat(tag 'br')
concat(link_to('#') do
concat(content_tag 'h2', 'Head \'em off')
@thesunwave
thesunwave / ml-ruby.md
Created May 14, 2016 20:57 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

def include_path?(options)
return false unless request
url_string = url_for(options)
if url_string.index("?")
request_uri = request.fullpath
else
request_uri = request.path
@thesunwave
thesunwave / electron-api.md
Created February 24, 2016 07:19 — forked from mrmlnc/electron-api.md
Electron API

Базовые возможности

process — это объект, позволяющий получить информацию о типе запущенного процесса (рендеринг или основной процесс), версию Chrome и Electron, а также путь до выполняемого js-файла.

Пользовательские элементы DOM:

Объект File — это абстракция над нативным File, передающая стандартному HTML5 file API путь к физическому расположению файла в файловой системе пользователя.

@thesunwave
thesunwave / gist:e4148c7e9f7ffd14e645
Last active August 29, 2015 14:26 — forked from dalethedeveloper/gist:1503252
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(