^ beginning of string
$ end of string
. any character (wildcard)
* match 0 or more times
+ match 1 or more times
? match 0 or 1 time
| alternative
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
def cls | |
system ('cls') #for cmd | |
system ('clear') #for mac / linux | |
end | |
class String | |
def green; "\033[32m#{self}\033[0m" end #< colorizing all instances of the main class String and method green. Solution taken from here: http://stackoverflow.com/questions/1489183/colorized-ruby-output | |
def red; "\033[31m#{self}\033[0m" end | |
def brown; "\033[33m#{self}\033[0m" 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
:: http://technet.microsoft.com/en-us/library/bb490894.aspx | |
:: F7 = history | |
:: Alt+F7 = history -c | |
:: F8 = Ctrl+R | |
:: Use & to run multiple commands e.g.: command1 & command2 | |
:: | |
:: 1. Go to your Windows folder and find regedit.exe | |
:: 2. Head over to: | |
:: HKEY_LOCAL_MACHINE\Software\Microsoft\Command | |
:: or |
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
XTerm*faceName: Bitstream Vera Serif Mono | |
xterm*faceSize: 13 | |
xterm*vt100*geometry: 80x60 | |
xterm*saveLines: 16384 | |
xterm*VT100.Translations: #override \ | |
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\ | |
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) | |
# update Xterm config: |
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
set -g default-terminal "screen-256color" | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-copycat' | |
set -g @plugin 'tmux-plugins/tmux-yank' | |
# Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
bind [ copy-mode |
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
# Assuming you champioin your other DB connection with a class. | |
module OtherDb | |
class Connection < ActiveRecord::Base | |
establish_connection :other_db | |
self.abstract_class = true | |
end | |
end | |
# Alway use the connection for other/legacy connections. |
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
### Node Class | |
using MemberUniquelizer | |
class Node < HashWithIndifferentAccess | |
attr_reader :id | |
# constructs a new hash based on injected | |
# headers and attributes | |
def self.from_rows(headers, attributes) | |
headers = uniqualize_headers(headers) |
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
module MemberUniquelizer | |
refine Array do | |
# makes each member within an array | |
# unique by appending a unique number | |
def uniquelize(ary = self) | |
ary.map { |member| format_member(member) } | |
.flatten | |
.uniq |
OlderNewer