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
function BINANCE_PRICE(coinsymbol, pair) { | |
var url = "https://api.binance.com/api/v3/ticker/price?symbol="+coinsymbol.toUpperCase()+pair.toUpperCase() | |
var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true}); | |
var json = response.getContentText(); | |
var data = JSON.parse(json); | |
return data.price | |
} | |
/* |
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
module RIDB | |
# A set of client classes for new RIDB API | |
# https://ridb.recreation.gov/api/v1 | |
# http://ridb-dev.nsitellc.com/docs/api/v1/ | |
# Usage: | |
# > $ridb = RIDB::Client.new(ENV['RIDB_API_KEY'], debug: true) | |
# Returns a list of organization items | |
# > $ridb.organizations.list.items |
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
class ActiveRecord::Base | |
def can_destroy? | |
self.class.reflect_on_all_associations.all? do |assoc| | |
assoc.options[:dependent] != :restrict || (assoc.macro == :has_one && self.send(assoc.name).nil?) || (assoc.macro == :has_many && self.send(assoc.name).empty?) | |
end | |
end | |
end |