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
array = [1,2,3,4,[1,2,[1,2,3,4],4],5] | |
while array.any? { |el| el.is_a?(Array) } do | |
array = array.each_with_object([]) do |element, flattened| | |
element.is_a?(Array) ? element.inject(flattened,&:<<) : flattened << element | |
end; | |
end; | |
p array |
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
array = [1,2,3,4,[1,2,[1,2,3,4],4],5] | |
while array.any? { |el| el.is_a?(Array) } do | |
array = array.each_with_object([]) do |element, flattened| | |
element.is_a?(Array) ? element.inject(flattened,&:<<) : flattened << element | |
end | |
end | |
p array |
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
0xde2e5B0018Da37BadFd913a5822D8e13Cf5C0856 |
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
0xa955a9c20b6160c02282C94B4BDEE2063c77405d |
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
0xde2e5B0018Da37BadFd913a5822D8e13Cf5C0856 |
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
The Architecture of the Ahoolee Blockchain | |
How the Ahoolee system works: | |
1. When adding a new store to the system, the search spider collects all the necessary | |
information about products from it. This information appears on https://ahoolee.com in real-time | |
mode. | |
2. When the user accesses the product card, the time of price update is checked and if the | |
information is considered out-of-date, a transaction is created to update the price and receives the | |
In Process status. A transaction is a set of urls for updating the price plus a smart contract for | |
parsing. | |
3. The first stage: miners search for a hash that gives the right to parse information and sign a |
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 'nokogiri' | |
require 'open-uri' | |
require 'parallel' | |
require_relative '../helpers/helper' | |
require_relative '../repo' | |
#Powered by SMF 1.1.19 | |
class SatsParser | |
DB = Repo.get_db |
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
0xf75C06B1A3452A9D7eE1Cb15f0E2Db0e9Cd0a1f7 |
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
def process_fat_accounts(pp,base) | |
sum = 0 | |
for i in (0..pp.size-1) do | |
mm = pp[i] | |
if mm > base | |
f = (mm/base) ** 1.3 | |
if pp[i] - f > base | |
pp[i] = (pp[i] - f).round(2) | |
sum = (sum + f).round(2) |
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
def process_fat_accounts(pp,base) | |
sum = 0 | |
for i in (0..pp.size-1) do | |
mm = pp[i] | |
if mm > base | |
f = (mm/base) ** 1.3 | |
if pp[i] - f > base | |
pp[i] = (pp[i] - f).round(2) | |
sum = (sum + f).round(2) |
OlderNewer