How to plot positions on a map by longitude and latitude using D3.js. This uses the UK map data from http://bost.ocks.org/mike/map/
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
# Where 'ts' is the time series (without transient behavior) | |
# a <- as.data.frame(cbind(spectrum(ts)$freq,spectrum(ts)$spec)) | |
# b <- order(a[2], decreasing=TRUE)[1] | |
# 1/a$V1[b] # !If this is the same as length(ts) then periodicity is 0(zero) | |
periodicity <- function(ts){ | |
if (length(unique(ts))==1){ | |
# No need for spectrum analysis as all values are same. Periodicity is zero. | |
return(0) | |
} else { |
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
date | close | |
---|---|---|
1-May-12 | 582.13 | |
30-Apr-12 | 583.98 | |
27-Apr-12 | 603.00 | |
26-Apr-12 | 607.70 | |
25-Apr-12 | 610.00 | |
24-Apr-12 | 560.28 | |
23-Apr-12 | 571.70 | |
20-Apr-12 | 572.98 | |
19-Apr-12 | 587.44 |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
background-color: #ffffff; | |
margin: 0; | |
overflow: hidden; | |
} |
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
# Run from 'rails console' | |
# Example cookie value. To find in Chrome: Inspect > Resources > Cookies | |
cookie = "cEJPOHAwUXdmMS9HK3gyVVYyNVR2QU03Q0ZhclZYNmRrN3RoelhrenQ3ZVhsSEtOTytQR29aZG1ZZWZmK254Y01QM2hyTVZMNlFOcWNCRytzM0pac0hpbFVWTUoxZEVicEZERXIzbEJENkJ4QVBZcDQyM24rclQxbnRFeXpkMVRicTdGMkVSU2F1U0FVcEdiYVBsRVFveThlMndPdDBlaThVVkl4TkFreUc0PS0tRFFmdlFzQnkrSmROT1ZNdnpjcnA4Zz09--3bf330ec809351525bd9df2c905a81a3bcc93c81" | |
# Example secret_key_base found in config/secrets.yml | |
secret_key_base = "df3def2698eb651febcb5ca64c3203a3cb3ff988e7ee5c4fd66135a24ddf5009ae0f95dee1e1d2e443538e647178f0cd87acc98d1082659bb03d89b8af1f2252" | |
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000) | |
secret = key_generator.generate_key("encrypted cookie") | |
sign_secret = key_generator.generate_key("signed encrypted cookie") | |
encryptor = ActiveSupport::MessageEncryptor.new(secret, sign_secret, serializer: ActiveSupport::MessageEncryptor::NullSerializer) | |
puts encryptor.decrypt_and_verify(URI.unescape(cookie)) |
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
# https://www.ibm.com/watson/developercloud/natural-language-understanding/api/v1/ | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
require 'pp' | |
uri = URI.parse("https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2017-02-27") | |
request = Net::HTTP::Post.new(uri) | |
request.basic_auth(user_id, password) |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.chart div { | |
font: 10px sans-serif; | |
background-color: steelblue; | |
text-align: right; | |
padding: 3px; | |
margin: 1px; |
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
year | money | number | |
---|---|---|---|
2005 | 550 | 35 | |
2006 | 600 | 40 | |
2007 | 700 | 45 | |
2008 | 800 | 60 | |
2009 | 900 | 70 | |
2010 | 850 | 65 | |
2011 | 880 | 67 | |
2012 | 900 | 70 | |
2013 | 1000 | 75 |
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
letter | frequency | |
---|---|---|
1 | 5000 | |
2 | 10000 | |
3 | 15000 | |
4 | 20000 | |
5 | 25000 | |
6 | 30000 | |
7 | 35000 | |
8 | 40000 | |
9 | 45000 |