Skip to content

Commit 39cef32

Browse files
committed
hi
1 parent 1458e54 commit 39cef32

4 files changed

Lines changed: 149 additions & 202 deletions

File tree

.bashrc

Lines changed: 15 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -106,155 +106,22 @@ function recent-branches() {
106106
echo $output
107107
}
108108

109-
# Autocomplete function for c command
110-
#function _c() {
111-
#cur=${COMP_WORDS[COMP_CWORD]}
112-
#branches=`git for-each-ref --sort=-committerdate refs/heads/ | head -n 10`
113-
114-
## By default bash breaks on "words", not lines. Set this magical garbage
115-
## so autocomplete works with line breaks, not one big string
116-
#local IFS=$'\n'
117-
118-
#output=''
119-
#while read -r branch;
120-
#do
121-
#output+=`echo $branch | sed 's/.*refs\/heads\///'`
122-
#local rawBranchName=`git show --quiet $(echo $branch | cut -d' ' -f1) --pretty=format:"%h <%an> %s (%cr)\'"`
123-
## If a commit message has backticks or dollar signs in it, bash will
124-
## try to interpolate it when outputting. Escape backtick and dollar
125-
## sign to prevent that
126-
#local sanitizedbranchName=`echo $rawBranchName | sed 's/\([$\`]\)/\\\1/g'`
127-
#output+="'"
128-
#output+=$sanitizedBranchname
129-
#output+="'"$'\n'
130-
#done <<< "$branches"
131-
132-
## Why do I lowercase the output?
133-
#response=''
134-
#for branch in $output
135-
#do
136-
#lowerBranch=`echo $branch | tr '[:upper:]' '[:lower:]'`
137-
#if [[ $branch =~ .*$cur.* ]]; then
138-
#response+=$branch$'\n'
139-
#fi
140-
#done
141-
142-
#COMPREPLY=( $( compgen -W "$response" -- $cur ) )
143-
#}
144-
145-
#function c() {
146-
#local newBranch=""
147-
#local inputted=""
148-
149-
#if [[ -z "$1" ]]; then
150-
#local branchOutput=`git for-each-ref --sort=-committerdate refs/heads/ | head -n 10`
151-
#local IFS=$'\n'
152-
153-
## Bash syntax for declaring array
154-
#declare -a branches
155-
156-
#local counter=0
157-
#local longestBranchLength=0
158-
159-
## When padding the output with printf, we need to take into account the
160-
## length of the branch name, plus any color codes we use, which aren't
161-
## printed, but are counted in printf's %-10s padding. We need to add in
162-
## the estimated string length of the color escape codes (including
163-
## color reset) to pad the branch name correctly
164-
#local colorLength=4
165-
#local numberOfColors=8
166-
167-
## Find the longest branch name for padding...
168-
#while read -r branch;
169-
#do
170-
#local branchName=`echo "$branch" | sed 's/.*refs\/heads\///'`
171-
#if [[ "${#branchName}" -gt "$longestBranchLength" ]]; then
172-
#longestBranchLength=${#branchName}
173-
#fi
174-
#done <<< "$branchOutput"
175-
176-
## Calculate how many characters to pad including color code length...
177-
#let local padLength="( longestBranchLength + 2 ) + ( colorLength * numberOfColors )"
178-
179-
## Show branches in a list with a counter
180-
#while read -r branch;
181-
#do
182-
#counter=`expr $counter + 1`
183-
#local branches=("${branches[@]}" "$branch")
184-
#local branchName=`echo "$branch" | sed 's/.*refs\/heads\///'`
185-
#local branchNamePrefix="$COLOR_PURPLE$counter. $COLOR_PINK $branchName"
186-
#local resetColor="$counter. $branchName"
187-
## this interpolates to something like `printf %-100s` which is
188-
## syntax for padding in printf
189-
#printf "%-${padLength}s" $branchNamePrefix
190-
#printf '%s \n' `git show --quiet $branchName --pretty=format:"%C(Yellow)%h %Cred<%an>%Creset %s %C(cyan)(%cr)%Creset"`
191-
#done <<< "$branchOutput"
192-
193-
## Prompt user for file. -n means no line break after echo
194-
#echo -n "$COLOR_YELLOW?$COLOR_RESET "
195-
#read branchNumber
196-
197-
#let "branchNumber+=-1"
198-
199-
#branchLength=${#branches[@]}
200-
201-
## lol runtime type checking
202-
#if [[ "$branchNumber" =~ ^[0-9]+$ ]]; then
203-
204-
#if [[ "$branchNumber" -ge "$branchLength" ]]; then
205-
#if [[ $branchLength == "1" ]]; then
206-
#echo "${COLOR_LIGHT_RED}Really?${COLOR_RESET}"
207-
#elif [[ "$branchNumber" == "10" ]]; then
208-
#echo "${COLOR_LIGHT_RED}This one doesn't go to eleven :(${COLOR_RESET}"
209-
#else
210-
#echo "${COLOR_LIGHT_RED}Please enter a number from 1 to ${branchLength}${COLOR_RESET}"
211-
#fi
212-
#return 1
213-
#fi
214-
215-
#newBranch=`echo "${branches[@]:$branchNumber:1}" | sed 's/.*refs\/heads\///' 2> /dev/null`
216-
217-
#if [[ -z "$newBranch" ]]; then
218-
#echo "${COLOR_LIGHT_RED}No git branch found named '${COLOR_CYAN}${newBranch}${COLOR_LIGHT_RED}?'${COLOR_RESET}"
219-
#return 1
220-
#fi
221-
#else
222-
#echo "${COLOR_LIGHT_RED}Please enter a numeric value.${COLOR_RESET}"
223-
#return 1
224-
#fi
225-
#else
226-
#inputted=1
227-
#newBranch=`echo "$1" | cut -d' ' -f1`
228-
#fi
229-
230-
#if [[ -n "$1" ]]; then
231-
#echo `git show --quiet "$newBranch" --pretty=format:"%C(Yellow)%h %Cred<%an>%Creset %s %C(cyan)(%cr)%Creset"`
232-
#fi
233-
234-
#if [[ $newBranch =~ ^pr ]]; then
235-
#echo -e "\ngit fetch $newBranch && git checkout $newBranch"
236-
#git fetch $newBranch && git checkout $newBranch
237-
#else
238-
#echo -e "\ngit checkout $newBranch"
239-
#git checkout $newBranch
240-
#fi
241-
242-
#}
243-
244-
# Wire up autocomplete
245-
#complete -F _c c
246-
247-
# Probably don't need this anymore, and could be a dangerous mis-type
248-
#function rbd() {
249-
#git fetch upstream && git rebase upstream/dev
250-
#}
251-
252-
# required for grunt ct
253-
#export LANG=en_US.UTF-8
254-
#export LC_ALL=
255-
256109
function what-is-listening-on-port() {
257-
lsof -n -i4TCP:$1 | grep LISTEN
110+
lsof -n -i4TCP:"$1" | grep LISTEN
111+
}
112+
113+
function kport() {
114+
local procc
115+
procc=$(lsof -n -i4TCP:"$1" | grep LISTEN)
116+
117+
if [[ -z $procc ]]; then
118+
echo "Nothing listening on port $1"
119+
else
120+
local pid
121+
pid=$(echo "$procc" | awk '{print $2}')
122+
echo "kill -2 $pid"
123+
kill -2 "$pid"
124+
fi
258125
}
259126

260127
# Don't wait for job termination notification

.salesforcerc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exp() {
4848
local apexCommand
4949
apexCommand='System.debug('"${2}"');'
5050
if [ "$3" != "quiet" ] && [ "$3" != "q" ]; then
51-
>&2 echo "${COLOR_BLUE}${BOLD}Executing:${COLOR_RESET}"
51+
>&2 echo "${COLOR_BLUE}${BOLD}Executing against ${COLOR_PURPLE}${BOLD}${1}${COLOR_BLUE}:${COLOR_RESET}"
5252
>&2 echo "${COLOR_BLUE}${apexCommand}${COLOR_RESET}"
5353
>&2 echo
5454
fi
@@ -88,7 +88,7 @@ stmt() {
8888
local apexCommand
8989
apexCommand=${2}
9090
if [ "$3" != "quiet" ] && [ "$3" != "q" ]; then
91-
>&2 echo "${COLOR_BLUE}${BOLD}Executing:${COLOR_RESET}"
91+
>&2 echo "${COLOR_BLUE}${BOLD}Executing against ${COLOR_PURPLE}${BOLD}${1}${COLOR_BLUE}:${COLOR_RESET}"
9292
>&2 echo "${COLOR_BLUE}${apexCommand}${COLOR_RESET}"
9393
>&2 echo
9494
fi
@@ -108,6 +108,7 @@ stmt() {
108108
}
109109

110110
alias orgls='open https://grhc.lightning.force.com/lightning/setup/DataManagementCreateTestInstance/home'
111+
alias orgids='open https://grhc.lightning.force.com/lightning/setup/DataManagementCreateTestInstance/home'
111112

112113
function orgid() {
113114
exp "$1" 'UserInfo.getOrganizationId()'
@@ -125,6 +126,29 @@ function whodat() {
125126
exp "$1" "[SELECT username FROM User WHERE Id = '$2']"
126127
}
127128

128-
alias dstatus='open https://grhc--uat.lightning.force.com/lightning/setup/DeployStatus/home'
129-
alias tflags='open https://grhc--andrewdev.lightning.force.com/lightning/setup/ApexDebugLogs/home'
129+
function soqldev() {
130+
exp AndrewDev "[$1]"
131+
}
132+
133+
function whatis() {
134+
exp $1 "((Id)'${2}').getSObjectType().getDescribe().getName()"
135+
}
136+
137+
declare -A INSTANCE_URLS
138+
INSTANCE_URLS[UAT]='https://grhc--uat.lightning.force.com'
139+
INSTANCE_URLS[AndrewDev]='https://grhc--andrewdev.lightning.force.com'
140+
# shellcheck disable=SC2034
141+
INSTANCE_URLS[Unused]='' # Used for shellcheck disable above :(
142+
143+
function deploy_status() {
144+
open "${INSTANCE_URLS[$1]}/lightning/setup/DeployStatus/home"
145+
}
146+
147+
function trace_flags() {
148+
open "${INSTANCE_URLS[$1]}/lightning/setup/ApexDebugLogs/home"
149+
}
150+
151+
alias dstatus='deploy_status UAT'
152+
alias tstatus='deploy_status AndrewDev'
153+
alias tflags='trace_flags AndrewDev'
130154

code/keybindings.json

Lines changed: 80 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,72 @@
11
// Place your key bindings in this file to overwrite the defaults
22
[
33
// Vim navigate backwards/forwards
4-
{ "key": "ctrl+o", "command": "workbench.action.navigateBack", "when": "editorTextFocus" },
5-
{ "key": "ctrl+i", "command": "workbench.action.navigateForward", "when": "editorTextFocus" },
6-
{ "key": "cmd+k p", "command": "extension.copyRelativePathOfActiveFile", "when": "editorTextFocus" },
7-
{ "key": "cmd+k f", "command": "workbench.action.files.copyPathOfActiveFile", "when": "editorTextFocus" },
8-
{ "key": "cmd-k l", "command": "latex-workshop.tab", "when": "editorTextFocus" },
9-
{ "key": "cmd-alt-m", "command": "workbench.action.terminal.focus" },
10-
{ "key": "cmd-alt-m", "command": "workbench.action.terminal.focus" },
11-
{ "key": "cmd-shift-b", "command": "editor.action.revealDefinition", "when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor" },
12-
4+
{
5+
"key": "ctrl+o",
6+
"command": "workbench.action.navigateBack",
7+
"when": "editorTextFocus"
8+
},
9+
{
10+
"key": "ctrl+i",
11+
"command": "workbench.action.navigateForward",
12+
"when": "editorTextFocus"
13+
},
14+
{
15+
"key": "cmd+k p",
16+
"command": "extension.copyRelativePathOfActiveFile",
17+
"when": "editorTextFocus"
18+
},
19+
{
20+
"key": "cmd+k f",
21+
"command": "workbench.action.files.copyPathOfActiveFile",
22+
"when": "editorTextFocus"
23+
},
24+
{
25+
"key": "cmd-k l",
26+
"command": "latex-workshop.tab",
27+
"when": "editorTextFocus"
28+
},
29+
{
30+
"key": "cmd-alt-m",
31+
"command": "workbench.action.terminal.focus"
32+
},
33+
{
34+
"key": "cmd-alt-m",
35+
"command": "workbench.action.terminal.focus"
36+
},
37+
{
38+
"key": "cmd-shift-b",
39+
"command": "editor.action.revealDefinition",
40+
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
41+
},
1342
// terrible defaults for "rails run specs"
14-
{ "key": "shift+cmd+t", "command": "workbench.action.reopenClosedEditor" },
15-
{ "key": "cmd+k cmd+f", "command": "extension.runFileSpecs", "when": "editorTextFocus" },
16-
43+
{
44+
"key": "shift+cmd+t",
45+
"command": "workbench.action.reopenClosedEditor"
46+
},
47+
{
48+
"key": "cmd+k cmd+f",
49+
"command": "extension.runFileSpecs",
50+
"when": "editorTextFocus"
51+
},
52+
// Clear notifications
53+
{
54+
"key": "cmd+k cmd+n",
55+
"command": "notifications.clearAll",
56+
"when": "editorTextFocus"
57+
},
58+
// Rerun last apex test class
59+
{
60+
"key": "cmd+k cmd+x",
61+
"command": "macros.runLastApexTestClass",
62+
"when": "editorTextFocus"
63+
},
64+
// Rerun last apex test
65+
{
66+
"key": "cmd+k cmd+t",
67+
"command": "macros.runLastApexTestMethod",
68+
"when": "editorTextFocus"
69+
},
1770
// Jump around in vim
1871
{
1972
"key": "cmd+]",
@@ -25,40 +78,38 @@
2578
"command": "workbench.action.editor.previousChange",
2679
"when": "editorTextFocus"
2780
},
28-
2981
// From https://stackoverflow.com/a/46087295/743464, note it applies to
3082
// splits with tabs which sucks
3183
{
3284
"key": "cmd+1",
3385
"command": "workbench.action.openEditorAtIndex1"
3486
},
3587
{
36-
"key": "cmd+2",
37-
"command": "workbench.action.openEditorAtIndex2"
88+
"key": "cmd+2",
89+
"command": "workbench.action.openEditorAtIndex2"
3890
},
3991
{
40-
"key": "cmd+3",
41-
"command": "workbench.action.openEditorAtIndex3"
92+
"key": "cmd+3",
93+
"command": "workbench.action.openEditorAtIndex3"
4294
},
4395
{
44-
"key": "cmd+4",
45-
"command": "workbench.action.openEditorAtIndex4"
96+
"key": "cmd+4",
97+
"command": "workbench.action.openEditorAtIndex4"
4698
},
4799
{
48-
"key": "cmd+5",
49-
"command": "workbench.action.openEditorAtIndex5"
100+
"key": "cmd+5",
101+
"command": "workbench.action.openEditorAtIndex5"
50102
},
51103
{
52-
"key": "cmd+6",
53-
"command": "workbench.action.openEditorAtIndex6"
104+
"key": "cmd+6",
105+
"command": "workbench.action.openEditorAtIndex6"
54106
},
55107
{
56-
"key": "cmd+7",
57-
"command": "workbench.action.openEditorAtIndex7"
108+
"key": "cmd+7",
109+
"command": "workbench.action.openEditorAtIndex7"
58110
},
59111
{
60-
"key": "cmd+8",
61-
"command": "workbench.action.openEditorAtIndex8"
112+
"key": "cmd+8",
113+
"command": "workbench.action.openEditorAtIndex8"
62114
}
63-
]
64-
115+
]

0 commit comments

Comments
 (0)