- Dynamic Dispatch
- Dynamic Method
- Ghost Methods
- Dynamic Proxies
- Blank Slate
- Kernel Method
- Flattening the Scope (aka Nested Lexical Scopes)
- Context Probe
- Class Eval (not really a 'spell' more just a demonstration of its usage)
- Class Macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :routes do | |
desc 'Print out all defined routes in CSV format.' | |
task :csv => :environment do | |
class CSVFormatter | |
def initialize | |
@buffer = [] | |
end | |
def result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pb-kill-line () { | |
zle kill-line | |
echo -n $CUTBUFFER | pbcopy | |
} | |
pb-kill-whole-line () { | |
zle kill-whole-line | |
echo -n $CUTBUFFER | pbcopy | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# best practice: linux | |
nano ~/.pgpass | |
*:5432:*:username:password | |
chmod 0600 ~/.pgpass | |
# best practice: windows | |
edit %APPDATA%\postgresql\pgpass.conf | |
*:5432:*:username:password | |
# linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// optimized for rails | |
document.addEventListener("turbolinks:load", () => { | |
$('[data-toggle="tooltip"]').tooltip() | |
$('[data-toggle="popover"]').popover() | |
if (document.querySelector('#target-btn')) { | |
// start of the actual copy paste action | |
document.querySelector('#target-btn').addEventListener("click", (event) => { | |
var el = document.getElementById("target-table"); | |
var body = document.body, range, sel; |
#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
namespace :csv do | |
desc "generates a migration file from column names from the CSV headers" | |
task create_migration: :environment do | |
def headers_from_CSV (filename) | |
csv_header_array = CSV.read(filename, headers: true).headers | |
return csv_header_array.map { |col_a| col_a.strip.downcase.gsub(' ', '_').gsub('.', '_') } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: Be sure to set the API key further down in the code! | |
require "net/http" | |
require "uri" | |
require "json" | |
class WIP | |
def initialize(api_key:) | |
@api_key = api_key | |
end |
NewerOlder