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
#!/usr/local/bin/ruby | |
print "Input /^\\d \\d [NSEW] [LMR]+$/: " | |
raise "Bad input" unless input = gets.chomp.match(/^(\d+)\s(\d+)\s([NSEW])\s([LMR]+)$/) | |
x, y, direction, moves = input[1].to_i, input[2].to_i, input[3], input[4] | |
compass = %w{ N E S W } | |
i = compass.index(direction) | |
fns = lambda { y+=1 }, lambda { x+=1 }, lambda { y-=1 }, lambda { x-=1 } |
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
diff --git a/dygraph.js b/dygraph.js | |
index 3d3326e..374c355 100644 | |
--- a/dygraph.js | |
+++ b/dygraph.js | |
@@ -1521,8 +1521,18 @@ Dygraph.prototype.drawGraph_ = function(data) { | |
for (var i = 1; i < data[0].length; i++) { | |
if (!this.visibility()[i - 1]) continue; | |
+ // Reduce the resolution of the dataset if necessary. | |
+ var data_length = data.length |
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 FastBeustSequence | |
class << self | |
def find_all(max) | |
@listener = [] | |
zero = Digit.new(nil, 0) | |
one = zero.next | |
start = Time.now | |
(1..10).each {|length| find(one, zero, length, 0, max, @listener)} | |
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
# List comprehension | |
# Haskell | |
[x*2 | x <- [1..10]] #=> [2,4,6,8,10,12,14,16,18,20] | |
# Ruby | |
(1..10).map { |x| x*2 } #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] | |
# List comprehension with condition | |
# Haskell | |
[x*2 | x <- [1..10], x*2 >= 12] #=> [12,14,16,18,20] |
NewerOlder