array.reduce(true) { |x, y| x and y }
Useful for checking in Rails if a collection of models all have a flag set to true.
E.g.:
signers.map(&:ready?).reduce(true) { |x, y| x and y }
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>App Redirection</title> | |
</head> | |
<body> | |
<!-- iframe used for attempting to load a custom protocol --> | |
<iframe style="display:none" height="0" width="0" id="loader"></iframe> |
I hereby claim:
To claim this, I am signing this object:
Write a function btc2usd
that calculates how much dollars you need to buy X bitcoin at this moment.
A sample asks
part of the orderbook looks like this:
asks = [['1.00000000', '100.00', 1], ['2.00000000', '200.00', 2], ['4.00000000', '400.00', 4], ['8.00000000', '800.00', 8], ['16.00000000', '1600.00', 16]]
// | | |
// amount of btc price per BTC no. of equal orders
module SimpleStateMachine | |
# Usage: | |
# | |
# First, extend your model of choise with this module | |
# | |
# extend SimpleStateMachine | |
# | |
# Then you can call the method states() and pass all the states | |
# that your model supports. E.g.: | |
# |
(function(){ | |
var externalStylesheets = []; | |
var fonts = {}; | |
function findExternalStylesheets(obj, callback) { | |
sheet = document.styleSheets, | |
i = sheet.length, | |
rule = null; | |
while( 0 <= --i ) { | |
if (sheet[i].cssRules === null) { |