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
var downloadTime = 3 * 1000 | |
function getIds() { | |
var ids = [] | |
jQuery('.game-row__overlay').each( | |
function () { | |
var h = jQuery(this).attr('href') | |
var id = h.match(/[a-z0-9]+/i)[0] | |
ids.push(id) |
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/bin/env ruby | |
require 'set' | |
$places = Set[] | |
$distance = Hash.new(Float::INFINITY) | |
for distance in DATA | |
/^(?<from>\w+) to (?<to>\w+) = (?<distance>\d+)/ =~ distance | |
$places << from << to |
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
$fib = Enumerator.new do |e| | |
a, b = 0, 1 | |
loop do | |
e.yield a | |
b, a = a + b, b | |
end | |
end | |
def $fib.[](n) | |
each_with_index.find { |x, i| i == n }.first |
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 FloatRange | |
def each | |
if Float === self.begin | |
current = self.begin | |
if exclude_end? | |
while current < self.end | |
yield current | |
current = current.next_float | |
end | |
else |
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
(ffr@ffr:mysql [master] ❷ ->0)$ cat /usr/local/opt/mysql/my.cnf | |
[mysqld] | |
sql_mode=NO_ENGINE_SUBSTITUTION,ALLOW_INVALID_DATES |
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
>> token = Tins::Token.new(bits: 128) | |
# => "ilTeQJ8zNHGo71cGnZiIfe" | |
>> token.length | |
# => 22 | |
>> token.bits | |
# => 130 | |
>> token = Tins::Token.new(length: 32) | |
# => "iEqo9h0wIoXJrMrkYZkplrwBjrfTyUma" | |
>> token.length | |
# => 32 |
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/bin/env ruby | |
require 'json' | |
r = '' | |
for line in DATA | |
line.gsub!(/^(\s*"[^=]+":\s*")(.*?)(",\s*)$/) { | |
b, m, a = $~.captures | |
"#{b}#{m.gsub('"', '\\"')}#{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
>> natural = (1..Float::INFINITY).lazy | |
# => #<Enumerator::Lazy: 1..Infinity> | |
>> even = natural.select { |x| x % 2 == 0 } | |
# => #<Enumerator::Lazy: #<Enumerator::Lazy: 1..Infinity>:select> | |
>> even.take(10).to_a | |
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] | |
>> |
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/Library/Formula/vim.rb b/Library/Formula/vim.rb | |
index d3f5ff2..ccc8cdc 100644 | |
--- a/Library/Formula/vim.rb | |
+++ b/Library/Formula/vim.rb | |
@@ -5,6 +5,7 @@ class Vim < Formula | |
# This package tracks debian-unstable: http://packages.debian.org/unstable/vim | |
url 'http://ftp.de.debian.org/debian/pool/main/v/vim/vim_7.3.923.orig.tar.gz' | |
sha1 'f308d219dd9c6b56e84109ace4e7487a101088f5' | |
+ depends_on 'gtk+' | |
head 'https://vim.googlecode.com/hg/' |
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 ::JSON::GenericObject | |
def self.load(source, proc = nil, opts = {}) | |
result = ::JSON.load(source, proc, opts.merge(:object_class => ::JSON::GenericObject)) | |
result.nil? ? ::JSON::GenericObject[] : result | |
end | |
def self.dump(obj, *args) | |
::JSON.dump(obj, *args) | |
end | |
end |
NewerOlder