layout | title | description | tags | ||
---|---|---|---|---|---|
default |
SQL Style Guide |
A guide to writing clean, clear, and consistent SQL. |
|
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
ENTRY_DATE %within% new_interval(min_time, max_time) |
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
# Using ldply returns a clean data frame, so avoids | |
# the lapply + do.call(rbind, ...) idiom | |
# Also, the .progress argument is very useful | |
df <- ldply(c(2002:2014, 52, 26, 13, 4, 1), function(x) { | |
sprintf("http://distrowatch.com/index.php?dataspan=%d", x) %>% | |
html() %>% | |
html_nodes(xpath = | |
"//table[@class = 'News' and @style = 'direction: ltr'][2]") %>% | |
.[[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
from IPython.display import display, HTML | |
display(HTML(data=""" | |
<style> | |
div#notebook-container { width: 95%; } | |
div#menubar-container { width: 65%; } | |
div#maintoolbar-container { width: 99%; } | |
</style> | |
""")) |
What if a function in a package has no examples? Or is poorly exampled? Wouldn't it be nice to find functioning instances of it "in the wild"?
Via Twitter, Noam Ross taught me a clever way to do such searches on GitHub. Put this into the GitHub search box to see people using the llply()
function from plyr
:
"llply" user:cran language:R
Or just click here.
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
library("ggthemes") | |
c("randomForest","dplyr","magrittr","ggplot2","ggthemes") -> packages | |
lapply(packages,library, character.only = TRUE) | |
getBREFTeamStatTable <- function(season_end = 2015, table_name = 'team', date = T){ | |
c('rvest','dplyr','pipeR','RCurl', 'XML','reshape2') -> packages | |
lapply(packages, library, character.only = T) | |
'http://www.basketball-reference.com/leagues/' -> base | |
(season_end-1) %>>% paste0("-",season_end) -> season | |
'NBA' -> league | |
table_name %>>% tolower -> table_name |
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" | |
# aliases to change a git repo from private to public, and public to private using gh-cli | |
alias gitpublic="gh repo edit --accept-visibility-change-consequences --visibility public" | |
alias gitprivate="gh repo edit --accept-visibility-change-consequences --visibility private" | |
# delete all your repos using gh-cli (please do not run this unless you want to delete all your repos) | |
gh repo list --limit 300 --json url -q '.[].url' | xargs -n1 gh repo delete --yes |
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
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
#!/bin/bash | |
# INSTALL ORACLE INSTANT CLIENT # | |
################################# | |
# NOTE: Oracle requires at least 1176 MB of swap (or something around there). | |
# If you are using CentOS in a VMWare VM, there's a good chance that you don't have enough by default. | |
# If this describes you and you need to add more swap, see the | |
# "Adding a Swap File to a CentOS System" section, here: | |
# http://www.techotopia.com/index.php/Adding_and_Managing_CentOS_Swap_Space |
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
God, give me privileges to change with serenity | |
the things that cannot be changed, | |
Permission to change the things | |
which should be changed, | |
and the Wisdom to distinguish | |
the lusers from the users. | |
Configuring several servers at a time, | |
Fixing multiple issues at a time, | |
Accepting hardware as a pathway to Perl, | |
Getting, as Stallman did, |
NewerOlder