Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from json import load, JSONEncoder | |
from optparse import OptionParser | |
from re import compile | |
float_pat = compile(r'^-?\d+\.\d+(e-?\d+)?$') | |
charfloat_pat = compile(r'^[\[,\,]-?\d+\.\d+(e-?\d+)?$') | |
parser = OptionParser(usage="""%prog [options] | |
Group multiple GeoJSON files into one output file. |
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
require 'json' | |
require 'nokogiri' | |
require 'open-uri' | |
r = /([\w\W]*)([NEVADA ]*[STATE ]*[CENTENNIAL ]*[HISTORIC[AL]*]* MA[R]*KER)\s(No.|No|number)\W*(\d*)\W*(.*)\W*(.*)\W*(.*)\W*(.*)\W*(.*)\W*/i | |
j = JSON.parse(open('http://shpo.nv.gov/historical-markers-json').read) | |
j.each do |js| | |
puts "#{js['slug']}" | |
output = Nokogiri::HTML(open("http://shpo.nv.gov/nevadas-historical-markers/historical-markers/#{js['slug']}")) | |
contents = output.search('.//article/p').text.strip |
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
Take a look at the Rails Guide to Testing: http://guides.rubyonrails.org/testing.html | |
Rails has unit testing using MiniTest by default. | |
When you ran the scaffolding it created a controller test /test/controllers/topics_controller_test.rb | |
Add to /test/models/topic_test.rb: | |
class TopicTest < ActiveSupport::TestCase | |
test "set a title" do | |
t = Topic.new |
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
Cloud9.io has a Rails template project, but it is Rails 4 | |
Check that it is still Rails 4: | |
$ rails -v | |
Rails 5 needs ruby 2.2.2 minimum, but I belive that Cloud9 has 2.3.0p0....just check: | |
$ ruby -v | |
Update the rails installation to 5: | |
$ gem install rails |
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
heroku pg:backups capture --app open-plaques-beta | |
curl -o db/db.dump `heroku pg:backups --app open-plaques-beta public-url` | |
createdb openplaques_$(date +'%Y-%m-%d') | |
pg_restore -d openplaques_$(date +'%Y-%m-%d') db/db.dump | |
sed -iE "s/openplaques_[0-9|-]*/openplaques_$(date +'%Y-%m-%d')/g" config/database.yml |
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
source "https://rubygems.org" | |
gem 'ckan', github: 'fishpercolator/CKAN' | |
gem 'open_uri_redirections' |
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
require 'csv' | |
require 'rgeo' | |
require 'proj4' | |
require 'rgeo/geo_json' | |
require 'json' | |
csv_text = File.read('Public_Database_-_Sept_2015.csv') | |
csv = CSV.parse(csv_text, :headers => true) | |
features = [] | |
coder = RGeo::GeoJSON::Coder.new |
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
contract jtoken { | |
mapping (address => uint) public balances; | |
address public admin; | |
uint tax; | |
function jtoken() | |
{ | |
balances[msg.sender] = 1000; | |
admin = msg.sender; | |
tax = 1; |
NewerOlder