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 './signed_request_uri' | |
| require 'rack/file' | |
| use Rack::SignedRequestUri, 'top secret' | |
| run Rack::File.new('images') |
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
| diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb | |
| index 37b3848..cb99cdd 100644 | |
| --- a/lib/nokogiri/xml/node_set.rb | |
| +++ b/lib/nokogiri/xml/node_set.rb | |
| @@ -234,8 +234,8 @@ module Nokogiri | |
| ### | |
| # Iterate over each node, yielding to +block+ | |
| - def each(&block) | |
| - 0.upto(length - 1) do |x| |
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
| diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb | |
| index 37b3848..149e90e 100644 | |
| --- a/lib/nokogiri/xml/node_set.rb | |
| +++ b/lib/nokogiri/xml/node_set.rb | |
| @@ -240,6 +240,14 @@ module Nokogiri | |
| end | |
| end | |
| + def map | |
| + a = [] |
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
| diff --git a/ext/nokogiri/xml_document.c b/ext/nokogiri/xml_document.c | |
| index 348344c..9f035ad 100644 | |
| --- a/ext/nokogiri/xml_document.c | |
| +++ b/ext/nokogiri/xml_document.c | |
| @@ -38,6 +38,13 @@ static void dealloc(xmlDocPtr doc) | |
| NOKOGIRI_DEBUG_END(doc); | |
| } | |
| +static void | |
| +mark(xmlDocPtr doc) |
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
| #include <string.h> | |
| #include <libxml/tree.h> | |
| #include <libxml/xpath.h> | |
| void | |
| main() | |
| { | |
| xmlDocPtr doc; | |
| xmlNodePtr cur; | |
| xmlXPathContextPtr ctx; |
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 'rack' | |
| require 'oil' | |
| app = lambda do |env| | |
| r = Rack::Request.new(env) | |
| io = File.new(File.join('images', File.basename(r.path)), 'rb') | |
| body = Oil::JPEG.new(io, r[:w].to_i, r[:h].to_i) | |
| [200, { 'Content-Type' => 'image/jpeg' }, body] | |
| 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
| require 'rack/handler' | |
| require 'socket' | |
| require 'puma/puma_http11' | |
| module Rack::Handler | |
| module Qute | |
| READ_SIZE = 500000 | |
| module NullIO | |
| def self.gets; 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
| require 'socket' | |
| require 'uri' | |
| require 'rack/handler' # gem install rack | |
| require 'rack/rewindable_input' | |
| require 'http/parser' # gem install http_parser.rb | |
| require 'stringio' | |
| module Rack::Handler | |
| module Qute | |
| def self.run(app, options={}) |
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
| # Puma hangs when it receives a SIGTERM in Linux x86_64. Reproduce as follows: | |
| # | |
| # Start Puma | |
| # $ puma | |
| # | |
| # Get the PID for Puma | |
| # $ ps u | |
| # | |
| # Send SIGTERM | |
| # $ kill 4321 |
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 'google-search' | |
| require 'uri' | |
| require 'open-uri' | |
| require 'fileutils' | |
| FileUtils.mkdir("images") | |
| Google::Search::Image.new(query: 'High Quality').each do |image| | |
| name = File.basename(URI.parse(image.uri).path) | |
| path = File.join("images", name) |