Skip to content

Instantly share code, notes, and snippets.


Vitalik Danchenko vitalikdanchenko

View GitHub Profile
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
vitalikdanchenko / http-status-codes
Created Oct 16, 2015
List of http status codes
View http-status-codes
100 = :continue
101 = :switching_protocols
102 = :processing
200 = :ok
201 = :created
202 = :accepted
203 = :non_authoritative_information
204 = :no_content
205 = :reset_content
206 = :partial_content
View deep_group.rb
require 'ostruct'
def deep_hash_with_default(level, default)
default_value = level > 1 ? deep_hash_with_default(level - 1, default) : default { |hash, key| hash[key] = default_value }
def deep_group(collection, *keys)
result = deep_hash_with_default keys.length, []
collection.each do |item|
vitalikdanchenko / ror_gems
Last active Mar 22, 2016
Useful Ruby on Rails gems
View ror_gems
gem 'haml-rails' # simple and pretty template language
gem 'devise' # authentication
gem 'cancan' # authorization
gem 'formtastic' # form builder, also use 'formtastic-bootstrap'
gem 'kaminari' # pagination, analogs: 'will_paginate'
gem 'draper' # use output decorators instead of helpers
gem 'paperclip' # upload files, analogs: 'carrierwave'
gem 'rmagick' # process images
gem 'letter_opener' # preview letters instead of sending
gem 'activeadmin' # administrative panel

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
View ruby_variables.rb
This is a machine generated main stub file using stdlib-doc
Created on 2016-08-05 11:57:38 +0300 by IntelliJ Ruby Stubs Generator.
This documentation uses content from the book "Programming Ruby - The Pragmatic Programmer's Guide"
Copyright (C) 2001 by Addison Wesley Longman, Inc. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at
Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder.
Distribution of the work or derivative of the work in any standard (paper) book form is prohibited unless prior permission is obtained from the copyright holder.
This documentation uses content form the article
vitalikdanchenko / internal_ip.js
Created Mar 31, 2015
Detect Internal IP address
View internal_ip.js
//get the IP addresses associated with an account
function getIPs(callback) {
var ip_dups = {};
//compatibility for firefox and chrome
var RTCPeerConnection = window.RTCPeerConnection
|| window.mozRTCPeerConnection
|| window.webkitRTCPeerConnection;
var useWebKit = !!window.webkitRTCPeerConnection;