Skip to content

Instantly share code, notes, and snippets.

@mfpiccolo
Created July 8, 2015 05:50
Show Gist options
  • Save mfpiccolo/d75f593f9ffeb2f9da2b to your computer and use it in GitHub Desktop.
Save mfpiccolo/d75f593f9ffeb2f9da2b to your computer and use it in GitHub Desktop.
require 'ffi'
module Scrape
extend FFI::Library
ffi_lib './target/debug/libscrape.dylib'
attach_function :get_body, [:string], :string
end
body = Scrape.get_body("http://doc.rust-lang.org")[191..230]
puts body.strip == "<title>Rust Documentation</title>" ? "Gone Dun It!" : "Uhhhh????"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment