Update stuff

This commit is contained in:
Rico Sta. Cruz 2015-05-06 00:00:33 +08:00
parent da76e474ce
commit 5e30301acd
8 changed files with 154 additions and 44 deletions

26
_drafts/gpg.md Normal file
View File

@ -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/

5
appleescript.md Normal file
View File

@ -0,0 +1,5 @@
Running
osascript -e "..."
display notification "X" with title "Y"

View File

@ -65,7 +65,6 @@ should_not doesn't wait for a timeout from the driver
## Finding
find
find_button
find_by_id
find_field
@ -74,47 +73,74 @@ should_not doesn't wait for a timeout from the driver
## Scoping
within
within '#delivery' do
fill_in 'Street', with: 'Hello'
end
within :xpath, '//article'
within_fieldset
within_table
within_frame
scope_to
find('#x').fill_in('Street', with: 'Hello')
# same as within
## Scripting
execute_script
evaluate_script
execute_script('$("input").trigger('change')')
evaluate_script('window.ga')
## Debugging
save_and_open_page
## Miscellaneous
## Page
all
body
current_url
page
.all('h3')
.body
.html
.source
.current_host
.current_path
.current_url
## Misc
drag
field_labeled
source
wait_until
current_path
## 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_checked_field
expect(page).to have_content '...'
expect(page).to have_css '...'
expect(page).to have_field
expect(page).to have_link
expect(page).to have_select
expect(page).to have_selector 'h1', text: 'Welcome'
expect(page).to have_table
expect(page).to have_text
expect(page).to have_link 'Logout',
href: logout_path
expect(page).to have_select 'Language',
selected: 'German'
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_xpath
expect(page).to have_selector 'h1', text: 'Welcome'
http://rubydoc.info/github/jnicklas/capybara/Capybara/RSpecMatchers
http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers

View File

@ -124,5 +124,8 @@ Routing
Test helpers
------------
include Devise::TestHelpers
https://github.com/plataformatec/devise/blob/1094ba65aac1d37713f2cba71f9edad76b5ca274/lib/devise/test_helpers.rb
sign_in @user
sign_out @user

19
git.md
View File

@ -97,3 +97,22 @@ Misc
Frank Sinatra (5):
Another 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

View File

@ -5,35 +5,43 @@ layout: default
### Commands
brew unlink git
brew link git
| Command | Description |
| --- | --- |
| `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
brew info git # List versions, caveats, etc
brew cleanup git # Remove old versions
brew edit git # Edit this formula
brew home git # Open homepage
| Command | Description |
| --- | --- |
| `brew update` | Update brew |
| `brew list` | List installed |
| `brew outdated` | What's due for upgrades? |
{:.no-head.greycode}
## Caskroom
### Updating caskroom
### Tricks
```sh
# Show latest casks
cd "/usr/local/Library/Taps/caskroom/homebrew-cask/Casks" && git log --pretty=format: --name-only --since="30 days ago" | egrep "Casks" | uniq
brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup
```
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"

View File

@ -17,6 +17,8 @@ end
# spec/controllers/*.rb
describe MyController do
describe "POST update" do
render_views #optional
it "works" do
post :update, { user: { name: "john" } }
@ -27,6 +29,8 @@ describe MyController do
expect(response).to be_success
expect(response).to have_http_status(200)
expect(response).to render_template("index")
response.status
end
end
end

19
vimscript-snippets.md Normal file
View File

@ -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