Update stuff
This commit is contained in:
parent
da76e474ce
commit
5e30301acd
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
### Encrypt decrypt
|
||||||
|
|
||||||
|
gpg --encrypt --recepient 'James Receiverson' foo.txt
|
||||||
|
gpg --decrypt foo.txt.gpg
|
||||||
|
|
||||||
|
### Making keys
|
||||||
|
|
||||||
|
gpg --gen-key
|
||||||
|
|
||||||
|
### Share your public key
|
||||||
|
|
||||||
|
# via file
|
||||||
|
gpg --armor --output pub.txt --export "Rico Sta. Cruz"
|
||||||
|
|
||||||
|
# via server
|
||||||
|
gpg --send-keys "Rico Sta. Cruz" --keyserver http://...
|
||||||
|
|
||||||
|
### Key management
|
||||||
|
|
||||||
|
gpg --list-keys
|
||||||
|
gpg --delete-key 'email@addie'
|
||||||
|
|
||||||
|
### See
|
||||||
|
|
||||||
|
* https://www.madboa.com/geek/gpg-quickstart/
|
|
@ -0,0 +1,5 @@
|
||||||
|
Running
|
||||||
|
|
||||||
|
osascript -e "..."
|
||||||
|
|
||||||
|
display notification "X" with title "Y"
|
64
capybara.md
64
capybara.md
|
@ -65,7 +65,6 @@ should_not doesn't wait for a timeout from the driver
|
||||||
|
|
||||||
## Finding
|
## Finding
|
||||||
|
|
||||||
find
|
|
||||||
find_button
|
find_button
|
||||||
find_by_id
|
find_by_id
|
||||||
find_field
|
find_field
|
||||||
|
@ -74,47 +73,74 @@ should_not doesn't wait for a timeout from the driver
|
||||||
|
|
||||||
## Scoping
|
## Scoping
|
||||||
|
|
||||||
within
|
within '#delivery' do
|
||||||
|
fill_in 'Street', with: 'Hello'
|
||||||
|
end
|
||||||
|
|
||||||
|
within :xpath, '//article'
|
||||||
within_fieldset
|
within_fieldset
|
||||||
within_table
|
within_table
|
||||||
within_frame
|
within_frame
|
||||||
scope_to
|
scope_to
|
||||||
|
|
||||||
|
find('#x').fill_in('Street', with: 'Hello')
|
||||||
|
# same as within
|
||||||
|
|
||||||
## Scripting
|
## Scripting
|
||||||
|
|
||||||
execute_script
|
execute_script('$("input").trigger('change')')
|
||||||
evaluate_script
|
evaluate_script('window.ga')
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
save_and_open_page
|
save_and_open_page
|
||||||
|
|
||||||
## Miscellaneous
|
## Page
|
||||||
|
|
||||||
all
|
page
|
||||||
body
|
.all('h3')
|
||||||
current_url
|
.body
|
||||||
|
.html
|
||||||
|
.source
|
||||||
|
.current_host
|
||||||
|
.current_path
|
||||||
|
.current_url
|
||||||
|
|
||||||
|
## Misc
|
||||||
|
|
||||||
drag
|
drag
|
||||||
field_labeled
|
field_labeled
|
||||||
source
|
|
||||||
wait_until
|
wait_until
|
||||||
current_path
|
|
||||||
|
|
||||||
## Capybara RSpec matchers
|
## Capybara RSpec matchers
|
||||||
|
|
||||||
|
# all selectors have:
|
||||||
|
text: 'welcome'
|
||||||
|
visible: true
|
||||||
|
count: 4
|
||||||
|
between: 2..5
|
||||||
|
minimum: 2
|
||||||
|
maximum: 5
|
||||||
|
wait: N # has_text
|
||||||
|
|
||||||
|
expect(page).to have_selector '.blank-state'
|
||||||
|
expect(page).to have_selector 'h1#hola', text: 'Welcome'
|
||||||
expect(page).to have_button
|
expect(page).to have_button
|
||||||
expect(page).to have_checked_field
|
expect(page).to have_checked_field
|
||||||
expect(page).to have_content '...'
|
|
||||||
expect(page).to have_css '...'
|
expect(page).to have_css '...'
|
||||||
expect(page).to have_field
|
expect(page).to have_field
|
||||||
expect(page).to have_link
|
expect(page).to have_link 'Logout',
|
||||||
expect(page).to have_select
|
href: logout_path
|
||||||
expect(page).to have_selector 'h1', text: 'Welcome'
|
expect(page).to have_select 'Language',
|
||||||
expect(page).to have_table
|
selected: 'German'
|
||||||
expect(page).to have_text
|
options: ['Engish', 'German']
|
||||||
|
with_options: ['Engish', 'German'] # partial match
|
||||||
|
expect(page).to have_table '#table'
|
||||||
|
expect(page).to have_text 'Hello',
|
||||||
|
type: :visible | :all
|
||||||
|
# alias: have_content
|
||||||
expect(page).to have_unchecked_field
|
expect(page).to have_unchecked_field
|
||||||
expect(page).to have_xpath
|
expect(page).to have_xpath
|
||||||
|
|
||||||
expect(page).to have_selector 'h1', text: 'Welcome'
|
|
||||||
|
|
||||||
http://rubydoc.info/github/jnicklas/capybara/Capybara/RSpecMatchers
|
http://rubydoc.info/github/jnicklas/capybara/Capybara/RSpecMatchers
|
||||||
|
http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers
|
||||||
|
|
|
@ -124,5 +124,8 @@ Routing
|
||||||
Test helpers
|
Test helpers
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
include Devise::TestHelpers
|
||||||
|
https://github.com/plataformatec/devise/blob/1094ba65aac1d37713f2cba71f9edad76b5ca274/lib/devise/test_helpers.rb
|
||||||
|
|
||||||
sign_in @user
|
sign_in @user
|
||||||
sign_out @user
|
sign_out @user
|
||||||
|
|
19
git.md
19
git.md
|
@ -97,3 +97,22 @@ Misc
|
||||||
Frank Sinatra (5):
|
Frank Sinatra (5):
|
||||||
Another commit
|
Another commit
|
||||||
This other commit
|
This other commit
|
||||||
|
|
||||||
|
## Bisect
|
||||||
|
|
||||||
|
git bisect start
|
||||||
|
git bisect bad # current version is bad
|
||||||
|
|
||||||
|
git checkout HEAD~8
|
||||||
|
npm test # see if it's good
|
||||||
|
git bisect good # current version is good
|
||||||
|
|
||||||
|
git bisect run npm test
|
||||||
|
|
||||||
|
git bisect reset # abort
|
||||||
|
|
||||||
|
### Quicker
|
||||||
|
|
||||||
|
git bisect start HEAD HEAD~10 -- # culprit is among the last test
|
||||||
|
git bisect run make
|
||||||
|
git bisect reset
|
||||||
|
|
58
homebrew.md
58
homebrew.md
|
@ -5,35 +5,43 @@ layout: default
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
|
|
||||||
brew unlink git
|
| Command | Description |
|
||||||
brew link git
|
| --- | --- |
|
||||||
|
| `brew install git` | Install a package |
|
||||||
|
| `brew upgrade git` | Upgrade a package |
|
||||||
|
| --- | --- |
|
||||||
|
| `brew unlink git` | Unlink |
|
||||||
|
| `brew link git` | Link |
|
||||||
|
| --- | --- |
|
||||||
|
| `brew list --versions git` | See what versions you have |
|
||||||
|
| `brew info git` | List versions, caveats, etc |
|
||||||
|
| `brew cleanup git` | Remove old versions |
|
||||||
|
| `brew edit git` | Edit this formula |
|
||||||
|
| `brew home git` | Open homepage |
|
||||||
|
{:.no-head.greycode}
|
||||||
|
|
||||||
brew list # List all installed
|
### Global commands
|
||||||
|
|
||||||
brew list --versions git # See what versions of `git` you have
|
| Command | Description |
|
||||||
brew info git # List versions, caveats, etc
|
| --- | --- |
|
||||||
brew cleanup git # Remove old versions
|
| `brew update` | Update brew |
|
||||||
brew edit git # Edit this formula
|
| `brew list` | List installed |
|
||||||
brew home git # Open homepage
|
| `brew outdated` | What's due for upgrades? |
|
||||||
|
{:.no-head.greycode}
|
||||||
|
|
||||||
|
## Caskroom
|
||||||
|
|
||||||
|
### Updating caskroom
|
||||||
|
|
||||||
### Tricks
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Show latest casks
|
brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup
|
||||||
cd "/usr/local/Library/Taps/caskroom/homebrew-cask/Casks" && git log --pretty=format: --name-only --since="30 days ago" | egrep "Casks" | uniq
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Tmux
|
### Show latest casks
|
||||||
----
|
|
||||||
|
```sh
|
||||||
|
cd "/usr/local/Library/Taps/caskroom/homebrew-cask/Casks" && \
|
||||||
|
git log --pretty=format: --name-only --since="30 days ago" | \
|
||||||
|
egrep "Casks" | uniq
|
||||||
|
```
|
||||||
|
|
||||||
Install a more-recent version that supports tmux -C
|
|
||||||
|
|
||||||
brew install https://github.com/adamv/homebrew-alt/raw/master/other/tmux-iterm2.rb
|
|
||||||
|
|
||||||
Install the wrapper for stuff to enable OSX clipboard to work
|
|
||||||
|
|
||||||
brew install reattach-to-user-namespace --wrap-pbcopy-and-pbpaste
|
|
||||||
|
|
||||||
Make sure that your VIM alias uses it
|
|
||||||
|
|
||||||
alias vim="reattach-to-user-namespace /Application/MacVim/Contents/MacOS/Vim"
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ end
|
||||||
# spec/controllers/*.rb
|
# spec/controllers/*.rb
|
||||||
describe MyController do
|
describe MyController do
|
||||||
describe "POST update" do
|
describe "POST update" do
|
||||||
|
render_views #optional
|
||||||
|
|
||||||
it "works" do
|
it "works" do
|
||||||
post :update, { user: { name: "john" } }
|
post :update, { user: { name: "john" } }
|
||||||
|
|
||||||
|
@ -27,6 +29,8 @@ describe MyController do
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(response).to render_template("index")
|
expect(response).to render_template("index")
|
||||||
|
|
||||||
|
response.status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
title: Vimscript snippets
|
||||||
|
---
|
||||||
|
|
||||||
|
### Bind function to key and command
|
||||||
|
|
||||||
|
command! YoFunctionHere call s:YoFunctionHere()
|
||||||
|
nnoremap <silent> x :call <SID>FunctionHere()<CR>
|
||||||
|
function! s:FunctionHere()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
### Stuff
|
||||||
|
|
||||||
|
expand('<cword>') " word under cursor
|
||||||
|
|
||||||
|
filereadable(fname)
|
||||||
|
fnamemodify(fname, ':e') " current file extension - see expand()
|
||||||
|
|
||||||
|
expand("%") " current file
|
Loading…
Reference in New Issue