This file contains hidden or 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
| #=================================================== | |
| # Demo multi-function roxygen2 - three ways to do it | |
| #=================================================== | |
| # This shows how things do work, including wierd corner cases, not | |
| # how they should be done. Most of the information comes from | |
| # http://r-pkgs.had.co.nz/man.html | |
| #==================================================== | |
| # Demo multi-function roxygen2 page using @describeIn |
This file contains hidden or 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
| setMethod("dbIsValid", "PostgreSQLConnection", function(dbObj, ...) { | |
| isValid <- tryCatch({dbGetInfo(dbObj)}, | |
| error = function(e) NULL) | |
| !is.null(isValid) | |
| }) | |
This file contains hidden or 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
| # alias to edit commit messages without using rebase interactive | |
| # example: git reword commithash message | |
| reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
| # git alias to tag and push a version | |
| tagpush = "!f(){ t=${1#v}; git tag v$t && git push origin v$t; }; f" | |
| # git alias to download single file from a repo in format of user/repo file | |
| fetch-file = "!f() { out=\"${4:-$(basename \"$2\")}\"; if gh api \"repos/$1/contents/$2\" ${3:+-f ref=$3} --jq '.content' 2>/dev/null | base64 --decode > \"$out\" 2>/dev/null; then echo \"Downloaded $2 → $out\"; else echo \"Failed\"; rm -f \"$out\"; fi; }; f" |
This file contains hidden or 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
| -- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor | |
| -- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password | |
| -- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility | |
| -- 4. Enable Applescript Editor and System UI Server | |
| -- 5. Trigger script from the menu | |
| -- 6. Enjoy being connected | |
| tell application "Cisco AnyConnect Secure Mobility Client" | |
| activate | |
| end tell |
This file contains hidden or 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
| # Requirements | |
| #sudo apt-get install libcurl4-gnutls-dev # for RCurl on linux | |
| #install.packages('RCurl') | |
| #install.packages('RJSONIO') | |
| library('RCurl') | |
| library('RJSONIO') | |
| query <- function(querystring) { | |
| h = basicTextGatherer() |
This file contains hidden or 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
| comments <- function(refs) { | |
| srcfile <- attr(refs[[1]], "srcfile") | |
| # first_line, first_byte, last_line, last_byte | |
| com <- vector("list", length(refs)) | |
| for(i in seq_along(refs)) { | |
| # Comments begin after last line of last block, and continue to | |
| # first line of this block | |
| if (i == 1) { | |
| first_byte <- 1 |
This file contains hidden or 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
| // Characters that are considered to separate words – does not include periods. | |
| // Place comma at the end of the line if there are multiple keybindings. | |
| {"word_separators": "/\\()\"‘-:,;~!@#$%^&*|+=[]{}`~?"} |