Skip to content

Instantly share code, notes, and snippets.

=begin
Template Name: template.rb
Author: Me
Instructions: $ rails new my-app -d<postgresql, mysql, sqlite3> -m example_template.rb
=end
def source_path
[File.expand_path(File.dirname(__FILE__))]
end
@dragonskyside
dragonskyside / watir_testfile.rb
Created June 15, 2022 20:44
Ruby code to illustrate main functionality of Watir.
require 'watir'
require 'webdrivers'
#Start a new session
browser = Watir::Browser.new
browser.goto ("wikipedia.org")
#Count all the links on the page.
puts browser.links.count
@dragonskyside
dragonskyside / nil_empty_blank_present_ffdierence_in_ruby
Created April 9, 2023 01:27 — forked from pythonicrubyist/nil_empty_blank_present_ffdierence_in_ruby
Difference between nil?, empty?, blank? and present? in Ruby and Ruby on Rasils.
# nil? can be used on any Ruby object. It returns true only if the object is nil.
nil.nil? # => true
[].nil? # => false
{}.nil? # => false
"".nil? # => false
" ".nil? # => false
true.nil? # => false
# empty? can be used on some Ruby objects including Arrays, Hashes and Strings. It returns true only if the object's length is zero.
nil.empty? # NoMethodError: undefined method `empty?' for nil:NilClass
// 1. Import everything
import { Wallet, BigNumber, ethers, providers } from 'ethers'
const { FlashbotsBundleProvider, FlashbotsBundleResolution } = require('@flashbots/ethers-provider-bundle')
/*
Mainnet
const provider = new providers.JsonRpcProvider('https://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh')
const wsProvider = new providers.WebSocketProvider('wss://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh')
*/