Skip to content

Instantly share code, notes, and snippets.

View vitalikdanchenko's full-sized avatar

Vitalik Danchenko vitalikdanchenko

View GitHub Profile
=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')
@vitalikdanchenko
vitalikdanchenko / ror_gems
Last active March 22, 2016 12:20
Useful Ruby on Rails 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
@vitalikdanchenko
vitalikdanchenko / internal_ip.js
Created March 31, 2015 08:28
Detect Internal IP address
//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;
@vitalikdanchenko
vitalikdanchenko / http-status-codes
Created October 16, 2015 06:52
List of 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
require 'ostruct'
def deep_hash_with_default(level, default)
default_value = level > 1 ? deep_hash_with_default(level - 1, default) : default
Hash.new { |hash, key| hash[key] = default_value }
end
def deep_group(collection, *keys)
result = deep_hash_with_default keys.length, []
collection.each do |item|

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
=begin
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 http://www.opencontent.org/openpub/)).
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 http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Variables_and_Constants#Pre-defined_Variables

Disable Device Enrollment Program (DEP) notification on macOS Monterey.md

NB! command-R is replaced with holding the power button on M1 macs.

With full reinstall (recommended)

   a. Boot into recovery using command-R during reboot, wipe the harddrive using Disk Utility, and select reinstall macOS

   b. Initial installation will run for approximately 1 hour, and reboot once