I hereby claim:
- I am sent-hil on github.
- I am senthil196 (https://keybase.io/senthil196) on keybase.
- I have a public key ASCi9RUVVKDkkW-LPPaJ_N6h6jccWFLmO5DaoSyUVc4sJAo
To claim this, I am signing this object:
The following below are what *I* think are best principles (after going through the last dozen mostly commented PRs): | |
1. Principle of least astonishment: does every single line follow principle of least astonishment? | |
This means if you, as a "reasonable" Rails programmer would be confused about this change, then this code either needs to be refactored or documented properly (there are situations that require us to break best practices, but these situations are very, very rare). | |
2. Readability: can I understand everything in PR (title, description, comments, code and tests) without having to ask the PR author to explain to me what it means? | |
And if there are edge case, are they documented properly? | |
3. Are edge cases, user input errors accounted for? | |
If the code relies on user input, what happens if the user is trying to sabotage? ie https://xkcd.com/327/ |
# Mike Bianco <[email protected]> | |
# Description: Wipe all metadata fields from Stripe used by SuiteSync. | |
# Helpful after a sandbox refresh. | |
# | |
# Usage: | |
# export STRIPE_KEY=sk_test_ | |
# ruby suitesync_wipe_metadata_fields.rb | |
require 'stripe' |
I hereby claim:
To claim this, I am signing this object:
//An experiment using `runtime/debug` package to see what info can | |
//be gotten in runtime. | |
package main | |
import ( | |
"log" | |
"runtime/debug" | |
"strings" | |
) |
#My fish prompt that I stole from somewhere and don't remember where to give credit. Sorry :( | |
#It's rather simple `senthil:~/p/es_console:master$`, shows current git branch if in a git repo. | |
function fish_prompt --description 'Write out the prompt' | |
# Just calculate these once, to save a few cycles when displaying the prompt | |
if not set -q __fish_prompt_hostname | |
# set -g __fish_prompt_hostname (hostname|cut -d . -f 1) | |
end | |
if not set -q __fish_prompt_normal | |
set -g __fish_prompt_normal (set_color normal) |
" Vim plugin for running the current test under cursor. I wrote it on a friday night | |
" when I was bored and sort of curious about vim plugin development. Needless to say | |
" I don't want to write any more vim plugins. | |
if exists("g:loaded_go_vroom") | |
finish | |
endif | |
if &compatible | |
echohl ErrorMsg |
function RunGoTestUnderLine() | |
let line_text = getline(".") | |
let raw_test_name = matchstr(getline("."), "Test.*\(") | |
if raw_test_name != -1 | |
let test_name = substitute(raw_test_name, "\(", "", "") | |
exec '!go test -run ' . test_name | |
endif | |
endfunction | |
autocmd FileType go nnoremap <leader>s :call RunGoTestUnderLine()<cr> |
1. Comments prefixed with // & space. | |
// right | |
//wrong | |
2. No blank lines between for & next line. | |
for _, name := range notAllowedSuffixes { | |
if strings.HasSuffix(sourceName, name) || strings.HasSuffix(targetName, name) { |
function fish_prompt --description 'Write out the prompt' | |
# Just calculate these once, to save a few cycles when displaying the prompt | |
if not set -q __fish_prompt_hostname | |
# set -g __fish_prompt_hostname (hostname|cut -d . -f 1) | |
end | |
if not set -q __fish_prompt_normal | |
set -g __fish_prompt_normal (set_color normal) | |
end |
prompt_rspec_stats() { | |
if [[ ((-d app || -d lib) && -d spec) ]]; then | |
if [[ (-d app) ]]; then | |
local app=`wc -l app/**/*.rb | grep -oE "[0-9]+" | tail -n 1` | |
else | |
local app=`wc -l lib/**/*.rb | grep -oE "[0-9]+" | tail -n 1` | |
fi | |
local spec=$((`wc -l spec/**/*.rb | grep -oE "[0-9]+" | tail -n 1`))+0.01 | |
local ratio=`printf "%.2f\n" $((spec/app))` |