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
<% @details.registrant_contact.each_pair do |key,val| %> | |
<% if not @details.registrant_contact.key.nil? %> #This line | |
<%= key %>:<%= val %> | |
<% end %> | |
<% 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
:29:in `require': /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:168: invalid multibyte char (US-ASCII) (SyntaxError) /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:168: invalid multibyte char (US-ASCII) /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:168: syntax error, unexpected $end, expecting ')' ...=> "#{@command.display_name} — #{@mate}", :page_title => "... ... ^ from :29:in `require' from /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb:1:in `' |
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
-:9: syntax error, unexpected $undefined, expecting ']' | |
puts doc.at_css("body")[\[#include <(\S+)>]\] |
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
matches = doc.at_css("body").text.scan([/#include <\S+>/]) | |
matches.each do |i| | |
print i | |
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
require 'nokogiri' | |
require 'open-uri' | |
url = "http://net.tutsplus.com/" | |
doc = Nokogiri::HTML(open(url)) | |
puts doc.at_css("title").text | |
doc.at_css("h1.post_title").each do |p| |
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 'nokogiri' | |
require 'open-uri' | |
url = "http://net.tutsplus.com/" | |
doc = Nokogiri::HTML(open(url)) | |
#puts doc.at_css("title").text | |
doc.at_css("h1").each do |p| | |
puts p.text |
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
Error detected while processing function snipMate#TriggerSnippet..snipMate#GetSnippetsForWordBelowCursor: | |
line 28: | |
E716: Key not present in Dictionary: get_snippets | |
Press ENTER or type command to continue | |
Error detected while processing function snipMate#TriggerSnippet..snipMate#GetSnippetsForWordBelowCursor: | |
line 28: | |
E116: Invalid arguments for function funcref#Call(s:snipMate['get_snippets'], [snipMate#ScopesByFile(), word])) | |
Press ENTER or type command to continue | |
Error detected while processing function snipMate#TriggerSnippet..snipMate#GetSnippetsForWordBelowCursor: | |
line 28: |
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
def http_get(url) | |
f = Fiber.current | |
http = EventMachine::HttpRequest.new(url).get | |
# This should resume when this Fibers http call is finished | |
http.callback { f.resume(http) } | |
http.errback { f.resume(http) } | |
return Fiber.yield | |
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
EM.synchrony do | |
# open 4 concurrent MySQL connections | |
db = EventMachine::Synchrony::ConnectionPool.new(size: 4) do | |
EventMachine::MySQL.new(host: "localhost") | |
end | |
# perform 4 http requests in parallel, and collect responses | |
multi = EventMachine::Synchrony::Multi.new | |
multi.add :page1, EventMachine::HttpRequest.new("http://service.com/page1").aget |
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
import urllib2, urllib | |
proxy = urllib2.ProxyHandler({'http': 'user:pass@00.00.000.00:1111'}) | |
auth = urllib2.HTTPBasicAuthHandler() | |
opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler) | |
urllib2.install_opener(opener) | |
conn = urllib2.urlopen('http://google.com/') | |
return_str = conn.read() |