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
| class FooIterator: | |
| def __init__(self, underlyingIter): | |
| self.underlying = underlyingIter | |
| def __iter__(self): | |
| return self | |
| def next(self): | |
| try: | |
| return (self.underlying.next(),) |
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
| import pyinotify | |
| import os | |
| import sys | |
| class Handler(pyinotify.ProcessEvent): | |
| def process_IN_MODIFY(self, event): | |
| if event.name.endswith('.tex'): | |
| print "Recompiling " + event.name + "..." | |
| os.popen('pdflatex ' + event.name).read() |
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
| require 'rb-inotify' | |
| notifier = INotify::Notifier.new | |
| notifier.watch('.', :modify, :recursive) do |event| | |
| if event.name.end_with? ".tex" | |
| puts "#{`date`.chomp}: Modified #{event.name}; recompiling..." | |
| `pdflatex -interaction batchmode -output-directory #{File.dirname(event.absolute_name)} #{event.absolute_name} > /dev/null 2>&1` | |
| end | |
| end |
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
| class String | |
| def smart_split | |
| sa = self.split(/"/).collect { |x| x.strip } | |
| return (1..sa.length).zip(sa).collect { |i,x| (i&1).zero? ? x : x.split }.flatten | |
| end | |
| end |
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
| while line = $stdin.gets | |
| puts "(" + line.split.map {|i| "'#{i}'"}.join(',') + ")," | |
| end |
NewerOlder