Skip to content

Instantly share code, notes, and snippets.

View jywarren's full-sized avatar

Jeffrey Warren jywarren

View GitHub Profile
@jywarren
jywarren / index.js
Last active December 13, 2015 18:38
voxel.js game
var createGame = require('voxel-engine')
var voxel = require('voxel')
var voxelGeometry = require('voxel-geometry')
window.game = createGame({
generate: voxel.generator['Valley'],
startingPosition: [35, 350, 35],
worldOrigin: [0,0,0],
controlOptions: {jump: 8}
})
@jywarren
jywarren / seths-grant.txt
Last active December 14, 2015 23:29
Seth's Open Knowledge Foundation grant draft
### How would your project help to further humanities research?
---------------------------------------------------------------
(e.g. it will make more content and data openly available for researchers to use,
it will produce novel insights into humanities data through visualisations...) *
GITenberg will improve the quality of Public Domain transcriptions of books
by treating books like open source code.
We (describe who) have compiled an archive of 40,000 [public domain?] ebooks, and
by applying open source software tools and techniques to these texts,
@jywarren
jywarren / rdiscount-fail.log
Created April 1, 2013 17:05
failure to gem install rdiscount -v '2.0.7.1'
$ gem install rdiscount -v '2.0.7.1'
Building native extensions. This could take a while...
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
/home/warren/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for random()... yes
checking for srandom()... yes
checking for rand()... yes
checking for srand()... yes
ruby-openid (2.2.3) lib/openid/server.rb:1259:in `decode'
ruby-openid (2.2.3) lib/openid/server.rb:1371:in `decode_request'
app/controllers/openid_controller.rb:20:in `index'
actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.11) lib/active_support/callbacks.rb:436:in `_run__75485377__process_action__959388488__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
@jywarren
jywarren / peaks.js
Last active July 25, 2016 23:43
Peak detection by Peter Davidowicz, additions by jywarren
/* Sample data:
$W.spectrum_data = {"lines":[
{"wavelength":842.3466875,"b":21,"g":13,"r":30,"average":21},
{"wavelength":841.455655089628,"b":13,"g":5,"r":22,"average":13},
{"wavelength":840.564622679257,"b":0,"g":0,"r":27,"average":9},
]
}
Now, setup a Spectral Workbench macro (although we'll keep it commented out until we're ready to deploy it):
@jywarren
jywarren / set_graph_height.js
Created July 17, 2013 15:47
Sets the graph maximum y-axis height
setup: function() {
// code to run on startup
flotoptions.yaxis.max = prompt("Enter a maximum graph height percentage, such as '50'");$.plot($("#graph"),$W.data,flotoptions);
},
draw: function() {
// code to run every frame
}
@jywarren
jywarren / smooth.js
Last active December 20, 2015 00:09
Smoothing macro for SpectralWorkbench.org
setup: function() {
// code to run on startup
smooth_initiate = function() {
alert('Click on the spectrum image to choose a starting row.')
$('#image').click(function(e){
smooth_complete(e.offsetY)
})
}
smooth_complete = function(row) {
@jywarren
jywarren / valley_detection.js
Last active December 20, 2015 11:09
Valley detection, based on peak detection macro by Peter Davidowicz, adapted by jywarren (https://gist.github.com/jywarren/6020668)
/* Sample data:
$W.spectrum_data = {"lines":[
{"wavelength":842.3466875,"b":21,"g":13,"r":30,"average":21},
{"wavelength":841.455655089628,"b":13,"g":5,"r":22,"average":13},
{"wavelength":840.564622679257,"b":0,"g":0,"r":27,"average":9},
]
}
Now, setup a Spectral Workbench macro (although we'll keep it commented out until we're ready to deploy it):
@jywarren
jywarren / linear_calibration.js
Created August 13, 2013 15:53
A macro for linear calibration based on Chris Fastie's: http://spectralworkbench.org/macro/cfastie/CalibrateTemplate, https://gist.github.com/Fastie/5109944. Enter the pixel distance to each peak (zero left), and the known wavelengths for the 2 peaks.
setup: function() {
// code to run on startup
$W.calibrate($W.spectrum_id,prompt("Enter pixel position A, counting from the left:"),prompt("Enter wavelength at pixel position A:"),prompt("Enter pixel position B, counting from the left:"),prompt("Enter wavelength at pixel position A:"))
},
draw: function() {
// code to run every frame
}
@jywarren
jywarren / mapknitter.log
Created October 17, 2013 19:43
mapknitter-error
RuntimeError in WarperController#create
FreeImage exception for type JPEG: Exif: Suspicious offset of first IFD value
RAILS_ROOT: /home/warren/sites/mapknitter.org
Application Trace | Framework Trace | Full Trace
/home/warren/sites/mapknitter.org/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb:14:in `with_image' /home/warren/sites/mapknitter.org/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb:14:in `with_image' /home/warren/sites/mapknitter.org/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:357:in `with_image' /home/warren/sites/mapknitter.org/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb:21:in `process_attachment' /home/warren/.rvm/gems/ruby-1.8.7-p330@default/gems/activesupport-2.3.15/lib/active_support/callbacks.rb:178:in `send' /home/warren/.rvm/gems/ruby-1.8.7-p330@default/gems/activesupport-2.3.15/lib/active_support/callbacks.rb:178:in