Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import sys
labels = []
values = []
for line in sys.stdin:
bits = line.strip().split(' ')
value = bits.pop(0)
label = ' '.join(bits)
def just_one_kind_of_response?(item, controller)
case controller
when 'actions'
if item.comments.blank? || item.suggestions.blank?
return true
end
when 'thoughts'
if item.comments.blank? || item.suggestions.blank?
@Jonty
Jonty / uniq.py
Created October 12, 2013 20:34 — forked from ntlk/uniq.py
import sys
def process_lines(lines):
for index, line in enumerate(lines):
last_line = lines[index - 1]
if line != last_line:
sys.stdout.write(line)
process_lines(sys.stdin.readlines())
@Jonty
Jonty / sort.py
Last active December 25, 2015 11:19 — forked from ntlk/sort.py
import sys
lines = sys.stdin.readlines()
lines.sort(reverse = ('-r' in sys.argv))
print ''.join(lines)