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
| begin | |
| RestClient.put("#{ENV['CLOUDANT_URL']}/SOMEDATABASE", "") | |
| rescue | |
| puts "database already created" | |
| 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
| DB = "#{ENV['CLOUDANT_URL']}/music" | |
| get "/doc/:doc" do | |
| doc = RestClient.get("#{DB}/#{params[:doc]}") | |
| @result = JSON.parse(doc) | |
| haml :doc_id | |
| 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
| %h1 A Doc from CouchDB! | |
| - @result.each do |k,v| | |
| %b=k | |
| %em=v | |
| %br |
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
| RestClient.put("https://USER:PASSWORD@APP.heroku.cloudant.com/DATABASENAME", "") |
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
| #!/usr/local/bin/node | |
| var sys = require('sys'); | |
| var http = require('http'); | |
| var url = require('url'); | |
| var PREFIX = '/db/'; | |
| var TARGET = 'http://example.cloudant.com'; | |
| var PORT = 8001; |
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
| var chart = d3.select('body') | |
| .append('svg:svg').attr('width', 800).attr('height', 200) | |
| chart.selectAll('rect') | |
| .data([13,8,2,0,23,29,100]) | |
| .enter() | |
| .append('svg:rect').attr('fill', 'steelblue') | |
| .attr('width', 20) | |
| .attr('height', function(d) { return d }) | |
| .attr('x', function(d,i) { return 20*i }) |
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
| function debounce(f, delay) { | |
| var timeout; | |
| return function() { | |
| if (f.active) return WARNING('Refresh throttled: operation already started less than 5 seconds ago.'); | |
| f.active = true; | |
| f.call(this, function() { | |
| if (delay) { | |
| if (timeout) clearTimeout(timeout); | |
| timeout = setTimeout(function() { f.active = false }, delay); | |
| } else { |
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
| @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700); | |
| #tracker { | |
| font-family: 'Open Sans', sans-serif !important; | |
| } | |
| button { | |
| font-family: inherit !important; | |
| } | |
| .preview { | |
| font-size: 14px !important; |
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
| @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700); | |
| #tracker { | |
| font-family: 'Open Sans', sans-serif !important; | |
| background: #eee !important; | |
| } | |
| button { | |
| font-family: inherit !important; | |
| } | |
| .preview { |
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
| @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700); | |
| #tracker { | |
| font-family: 'Open Sans', sans-serif !important; | |
| background: #eee !important; | |
| } | |
| button { | |
| font-family: inherit !important; | |
| } | |
| .preview { |