- no upfront installation/agents on remote/slave machines - ssh should be enough
- application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
- configuration templating
- environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
- deployment process run from Jenkins
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# Create a function programmatically by creating its constituents: | |
# an argument list, a function body of expressions, and an enclosing environment | |
args <- alist(x=,y=) | |
exps <- expression(z <- x^2 + y^2, z <- sqrt(z), return(z)) | |
body <- as.call(c(as.name("{"), exps)) | |
f <- as.function(x = c(args,body), envir = parent.frame()) | |
f(x=1,y=1) |
This file contains 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
## Comparing execution times between OpenCPU (RApache) and FastRWeb (Rserve and HTTP). | |
## Same requests and same code. Note that FastRWeb is up to 13 times faster on the 2nd call. | |
# OpenCPU: summarize 2 layers across districts for the whole of SSA, return json of summary table | |
# and then json of all pixel values for mapping | |
$ time curl http://127.0.0.1/ocpu/library/hcapi3/R/getLayer/json \ | |
-d '{"var" : ["whea_h", "AEZ16_CLAS"], "by" : "ADM2_NAME_ALT"}' -X POST -H "Content-Type:application/json" | |
[...] | |
{ |
This file contains 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
# ipak function: install and load multiple R packages. | |
# check to see if packages are installed. Install them if they are not, then load them into the R session. | |
ipak <- function(pkg){ | |
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] | |
if (length(new.pkg)) | |
install.packages(new.pkg, dependencies = TRUE) | |
sapply(pkg, require, character.only = TRUE) | |
} |
This file contains 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
require(caret) | |
#load some data | |
data(USArrests) | |
### Prepare Data (postive observations) | |
# add a column to be the strata. In this case it is states, it can be sites, or other locations | |
# the original data has 50 rows, so this adds a state label to 10 consecutive observations | |
USArrests$state <- c(rep(c("PA","MD","DE","NY","NJ"), each = 5)) | |
# this replaces the existing rownames (states) with a simple numerical index |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
This file contains 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
//Hide price and add-to-cart button for non-logged in users. | |
function woocommerce_template_loop_price() { | |
if ( is_user_logged_in() ) | |
woocommerce_get_template( 'loop/price.php' ); | |
} | |
function woocommerce_template_loop_add_to_cart() { | |
if ( is_user_logged_in() ) | |
woocommerce_get_template( 'loop/add-to-cart.php' ); |
This file contains 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
<?php | |
/** | |
* Code goes in functions.php or a custom plugin. | |
*/ | |
add_filter( 'woocommerce_states', 'malaysia_woocommerce_states' ); | |
function malaysia_woocommerce_states( $states ) { | |
$states['MY'] = array( | |
'JHR' => __('Johor', 'woocommerce') , |
NewerOlder