The current solar terminator is shown.
Thanks to Ben Elsen and NOAA for help implementing the correct equations for the position of the sun, which turned out to be quite a bit more complicated than I expected.
require 'java' | |
require 'benchmark' | |
def foo | |
Benchmark.measure { | |
sc = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD, org.jruby.embed.LocalVariableBehavior::TRANSIENT) | |
sc.runScriptlet("require 'win32api'") | |
sc.runScriptlet("SHGetFolderPath = Win32API.new 'shell32', 'SHGetFolderPath', 'LLLLP', 'L'") | |
sc.terminate | |
sc = nil |
require 'java' | |
require 'benchmark' | |
def foo | |
Benchmark.measure { | |
sc = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD, org.jruby.embed.LocalVariableBehavior::TRANSIENT) | |
sc.runScriptlet("require 'ffi'") | |
sc.runScriptlet <<-RUBY | |
Fork = Object.new | |
lib = FFI::DynamicLibrary.open('/usr/lib/libc.dylib', FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL) |
class Array | |
# See https://en.wikipedia.org/wiki/Run-length_encoding. | |
def rle | |
chunk {|e| e }.map {|e, a| [e, a.length] } | |
end | |
end | |
raise "Incorrect rle function." unless [1,1,1,2,3,3].rle == [ |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
body { | |
font:normal 14px/20px 'Georgia', serif; | |
} | |
</style> | |
</head> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.0.1/mapbox.js'></script> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.1/mapbox.css' rel='stylesheet' /> | |
<!--[if lte IE 8]> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.1/mapbox.ie.css' rel='stylesheet' > | |
<![endif]--> | |
<style> | |
body { margin:0; padding:0; } |
The current solar terminator is shown.
Thanks to Ben Elsen and NOAA for help implementing the correct equations for the position of the sun, which turned out to be quite a bit more complicated than I expected.
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/topojson.v1.min.js"></script> | |
<style> | |
path { | |
fill: none; | |
stroke-linejoin: round; | |
} |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title></title> | |
<script src='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.uncompressed.js'></script> | |
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' /> | |
<!--[if lte IE 8]> | |
<link href='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.ie.css' rel='stylesheet'> | |
<![endif]--> |
Crashes in Chrome Version 38.0.2125.104
enum Expression { | |
Literal(u32), | |
Add(Box<Expression>, Box<Expression>), | |
Sub(Box<Expression>, Box<Expression>) | |
} | |
impl Expression { | |
fn map<F: Fn(Expression) -> Expression>(self, f: F) -> Expression { | |
match self { | |
Expression::Literal(_) => self, |