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
require 'logger' | |
class String | |
LOGGER = Logger.new($stderr) | |
def -@; LOGGER.info self; end | |
end | |
# Extracted earlier, hardcoded for speed | |
ENTITIES = %w(I-ORG O I-MISC I-PER I-LOC B-LOC B-MISC MO B-ORG) |
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 macruby | |
framework 'cocoa' | |
loop do | |
puts NSWorkspace.sharedWorkspace.activeApplication['NSApplicationPath'] | |
sleep 1 | |
end |
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 | |
# gem install colored | |
require 'colored' | |
features = [] | |
Dir['{rec.sport.hockey,talk.politics.guns}/*'].each do |filename| | |
puts "Extracting features for #{filename.blue.bold}" | |
begin |
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
# I'm just working on a quick script... | |
true_positives = ... | |
false_negatives = ... | |
# Using printf debugging I'd normally do this | |
p true_positives | |
p false_negatives |
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
delay = (ms, fn) -> | |
setTimeout fn, ms | |
Array::max = -> | |
max = @[0]; | |
for elm in @ when elm > max | |
max = elm | |
max | |
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 NSResponder | |
def acceptsFirstResponder= val | |
(@acceptsFirstResponder = val).tap do | |
instance_eval do | |
def acceptsFirstResponder | |
@acceptsFirstResponder | |
end | |
self | |
end |
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
# Kup. A small all-coffee template language with a syntax like css | |
# | |
# Based on: | |
# * CoffeeKup - https://github.com/mauricemach/coffeekup | |
# * jQuery Builder - https://github.com/quackingduck/jquery.builder.js | |
# TODO: | |
# * stricter regex for tags | |
# The compiler, takes your template and returns a compiled one |
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 Symbol | |
def to_selector | |
"#{self}:".to_sym | |
end | |
end | |
class NSObject | |
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
require 'rake/clean' | |
CLOBBER.add *File.read('.gitignore').split |
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
require 'parslet' | |
tree = {:multi=> | |
[{:tag=>{:name=>"Foo"}}, | |
{:block=>{:name=>"Foo", :multi=>[{:static=>"Bar"}]}}]} | |
transformer = Parslet::Transform.new do | |
rule :static => simple(:text) do | |
'STATIC' |