This file contains hidden or 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 ranges(io, max_step = 1) | |
| in_range = false | |
| first = nil | |
| last = nil | |
| io.each_line do |line| | |
| id = line.to_i | |
| if first.nil? | |
| first = id | |
| last = id |
This file contains hidden or 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 group_continuous(io) | |
| result = [] | |
| range_start = nil | |
| offset = 0 | |
| io.each_line do |line| | |
| id = line.to_i | |
| puts "#{id}\t#{range_start}\t#{offset}" | |
| if !range_start.nil? && id == range_start + offset + 1 | |
| offset = offset + 1 |
This file contains hidden or 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 countCSSRules() { | |
| var results = '', | |
| log = ''; | |
| if (!document.styleSheets) { | |
| return; | |
| } | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| countSheet(document.styleSheets[i]); | |
| } | |
| function countSheet(sheet) { |
This file contains hidden or 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 | |
| class Utils | |
| def self.staged_files(*dirs) | |
| @staged_files ||= {} | |
| @staged_files[dirs.join(' ')] ||= `git diff --cached --name-only #{dirs.join(' ')} | xargs`.chomp | |
| end | |
| end |