Rails 4 fork
Because loading gems can take longer than you think
$ curl -fsSL https://gist.github.com/raw/6121664/benchmark.rb | ruby
............................................................[DONE]| DROP SCHEMA tmp CASCADE; | |
| CREATE SCHEMA tmp ; | |
| SET search_path = tmp ; | |
| -- table definitions | |
| CREATE TABLE user_hits ( | |
| day DATE, | |
| user_id INT, |
| require 'face' | |
| client = Face.get_client(api_key: 'XXX', api_secret: 'XXX') | |
| # training skybiometry to recognize Johnny Depp | |
| resp = client.faces_detect(urls: %w[http://topmostcelebrities.blogsome.com/wp-admin/images/Johnny%20Depp-0.jpg]) | |
| client.tags_save(uid: 'johnnydepp@celebs', tids: resp['photos'][0]['tags'][0]['tid']) | |
| client.faces_train uids: 'johnnydepp@celebs' | |
| # trying to recognize it from other pic | |
| client.faces_recognize(uids: 'all@celebs', urls: %w[http://images5.fanpop.com/image/photos/31400000/Johnny-johnny-depp-31410766-861-1023.jpg]) |
| # https://www.youtube.com/watch?v=uTR__8RvgvM | |
| # ---------------------------------------------------------------------------- # | |
| Project = Struct.new(:creator) | |
| Person = Struct.new(:address) | |
| Address = Struct.new(:country) | |
| Country = Struct.new(:capital) | |
| City = Struct.new(:weather) | |
| class Optional |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| <style id="jsbin-css"> | |
| ul, ol, li { | |
| list-style: none; | |
| margin: 0; |
| <?xml version="1.0" encoding="utf-8"?> | |
| <Client name="Philips"> | |
| <Identification> | |
| <Header name="User-Agent" substring="Philips"/> | |
| <Header name="User-Agent" substring="stagefright"/> | |
| </Identification> | |
| <Settings> | |
| <Setting name="EmitAlbumArtResources" value="true" /> | |
| </Settings> |
| require "uri" | |
| require "net/http" | |
| class RemoteFileStream | |
| def initialize(url, headers: {}) | |
| @uri = URI(url) | |
| @headers = headers | |
| end | |
| def each_line(&block) |
| def paginate | |
| return enum_for(:paginate) unless block_given? | |
| page = 0 | |
| page_count = nil | |
| partners = [] | |
| loop do | |
| response = fetch_all(page) | |
| page_count ||= (response['partners_count'].to_f / PARTNERS_PER_PAGE) | |
| yield response["partners"] | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/rest/response/parser.rb:24 :in `extract_headers` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/rest/response/parser.rb:12 :in `apply` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/rest/handler.rb:8 :in `block in call` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/seahorse/client/response.rb:43 :in `block in on` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/seahorse/client/http/response.rb:139 :in `block in on_success` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/seahorse/client/http/response.rb:166 :in `block in listener` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/seahorse/client/http/response.rb:130 :in `on_done` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/seahorse/client/http/response.rb:137 :in `on_success` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/seahorse/client/response.rb:42 :in `on` | |
| [GEM_ROOT]/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/rest/handler.rb:8 :in `call` |
| class Bottles | |
| def song | |
| verses(99, 0) | |
| end | |
| def verses(from_bottle_count, to_bottle_count) | |
| from_bottle_count | |
| .downto(to_bottle_count) | |
| .map { |c| verse(c) } | |
| .join("\n") |