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
require 'json' | |
require 'csv' | |
require 'amazing_print' | |
require 'uri' | |
require 'net/http' | |
project_token = 'adhBi59dc13U7RxbgNE5HQ' | |
URL = 'https://sfg.taxonworks.org/api/v1/' | |
url = URL + '/collection_objects' + '?project_token=' + project_token |
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
Reinstalled MacOS from scratch once more to be absolutely sure the procedure works. The list of commands after this second reinstall were these: | |
(Installed Xcode and Firefox first) | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
\curl -sSL https://get.rvm.io | bash -s stable --ruby | |
brew edit proj | |
(Added patch referenced above) | |
brew install proj -s # Pay attention to -s argument, the patch won't be applied oherwiese. | |
brew install postgis | |
brew services start postgresql |
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
concern :data_routes do |options| | |
collection do | |
get 'download' | |
get 'list' | |
post 'batch_preview' | |
get 'autocomplete' | |
end | |
member do | |
post 'search' | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Edit point location (with georeferencing)</title> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
padding: 40px; |
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
The problem is pretty straightforward, for a rails 3.0.10 app (upgrading form 2.3.10, which uses match style routes), ruby, 1.9.2. | |
I have basic routes: | |
/projects/1/foo/bar/1.json # controller => foo, :action => bar, etc... | |
/projects/1/public/foo/bar/1.json # controller => public/foo, :action => bar, etc.. | |
I need to match the "public/foo" controller first, if no public provided just match "foo" as the controller. The format needs to be optional. | |
My routes.rb: |
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
Solved by adding AllowEncodedSlashes On to the httpd.conf (must be in the virtual if using virtual). | |
I'm stumbling here because this is a problem that does not occur in dev, but does occur in production. | |
Last three routes- | |
map.connect ':controller/:action/:id.:format', | |
:controller => 'proj', | |
:requirements => {:action => /\w*/} |
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
named_scope :that_are_homonyms, { | |
:group => "sensus.label_id", | |
:joins => 'JOIN sensus on labels.id = sensus.label_id', | |
:select => "labels.*, count(distinct sensus.ontology_class_id) as total", | |
:having => 'total > 1' | |
} | |
When I do | |
bar.foo.that_are_homonyms.size # => 1000s (wrong) |
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
@specimens = Specimen.find(:all, | |
:include => [:ce, :otus], | |
:joins => "LEFT JOIN otu_groups_otus og ON otus.id = og.otu_id", | |
:conditions => "og.otu_group_id = 124") |
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
require 'test/unit' | |
## | |
# Variant generator returns all possible combinations of elements of all given arrays. | |
# Running this gist will run the tests. For normal usage, simply copy VariantsGenerator module. | |
module VariantsGenerator | |
module_function | |
## | |
# Operates on arrays. |
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
require 'test/unit' | |
#require 'ruby-debug' | |
## | |
# Variant generator returns all possible combinations of elements of all given arrays. | |
# Running this gist will run the tests. For functionality only this module is needed. | |
module VariantsGenerator | |
extend self | |
## |