Skip to content

Instantly share code, notes, and snippets.

@rishiip
rishiip / .irbrc
Created June 7, 2020 15:57
This is my current irbrc file which contains lots of helpful things - Medium
require 'irb/completion'
require 'rubygems'
ActiveRecord::Base.logger.level = 1 if defined?(ActiveRecord)
IRB.conf[:SAVE_HISTORY] = 1000
# Overriding Object class
class Object
# Easily print methods local to an object's class
def lm
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111