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
<!-- include only the hosted fields script to the page --> | |
<script src="https://js.braintreegateway.com/web/3.53.0/js/hosted-fields.min.js"></script> | |
<script> | |
// pass the authorization directly into Hosted Fields | |
braintree.hostedFields.create({ | |
authorization: 'client_token_or_tokenization_key' | |
// the rest of the Hosted Fields configuration goes here | |
}, function (hostedFieldsErr, hostedFieldsInstance) { | |
// finish by adding event listeners to trigger tokenization requests on a button click | |
}); |
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
<!-- add both the client script and the hosted fields script to the page --> | |
<script src="https://js.braintreegateway.com/web/3.55.0/js/client.min.js"></script> | |
<script src="https://js.braintreegateway.com/web/3.55.0/js/hosted-fields.min.js"></script> | |
<script> | |
// create the client instance using a client token or tokenization key | |
braintree.client.create({ | |
authorization: 'client_token_or_tokenization_key' | |
}, function (clientErr, clientInstance) { | |
// pass the client instance into the Hosted Fields create method | |
braintree.hostedFields.create({ |
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
mike@rbci:~$ psql -U postgres | |
psql (9.0.3) | |
Type "help" for help. | |
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0'; | |
UPDATE 1 | |
postgres=# \c template0 | |
You are now connected to database "template0". | |
template0=# update pg_database set datistemplate = FALSE where datname = 'template1'; | |
UPDATE 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
desc "install R packages" | |
task :install_R_packages do | |
R_packages = File.read("#{release_path}/R_packages.txt").lines.map { |line| line.strip } | |
R_package_cmd = R_packages.map do |package| | |
'if(!require(\"'+package+'\")){ install.packages(\"'+package+'\",lib=c(\"'+shared_path+'/R\"), repos=\"http://cran.cnr. | |
berkeley.edu/\"); };' | |
end.join(' ') | |
sudo "sh -c 'if [ ! -d #{shared_path}/R ]; then mkdir #{shared_path}/R; fi'" |
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
after("deploy:update_code") do | |
deploy.install_R_packages | |
end |
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(data.table); | |
library(maps); | |
library(maptools); | |
library(spatstat); | |
library(zipcode); | |
library(GISTools) | |
#load the zipcode dataset | |
data(zipcode); | |
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
curl -X POST -H "content-type: application/json" http://localhost:8098/mapred --data @-<<\EOF | |
{ | |
"inputs":"login:development:users", | |
"query":[ | |
{ | |
"map":{ | |
"language":"javascript", | |
"source":"function(v) { | |
return [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
-module(bbp_proc). | |
-compile([export_all]). | |
% Concurent Proccess Excercises | |
% http://www.erlang.org/course/exercises.html | |
% Two-way messenger | |
init_two_way_messages() -> | |
Pid1 = spawn(fun two_way_messenger/0), | |
Pid2 = spawn(fun two_way_messenger/0), |
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
-module(bbp). | |
-export([len/1]). | |
-export([reverse/1]). | |
-export([is_palindrome/1]). | |
-export([flatten/1]). | |
-export([distinct/1]). | |
-export([pack/1]). | |
len([]) -> 0; | |
len(L) -> inner_len(L, 0). |
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
diff --git a/app/assets/javascripts/application.js.coffee.erb b/app/assets/javascripts/application.js.coffee.erb | |
index 1754c77..29574ac 100644 | |
--- a/app/assets/javascripts/application.js.coffee.erb | |
+++ b/app/assets/javascripts/application.js.coffee.erb | |
@@ -6,22 +6,26 @@ | |
# | |
#= require jquery | |
#= require jquery_ujs | |
+#= require_self | |
#= require_tree . |
NewerOlder