Skip to content

Instantly share code, notes, and snippets.

View JakeAustwick's full-sized avatar

Jake Austwick JakeAustwick

  • Software Development
  • United Kingdom
View GitHub Profile
<% @details.registrant_contact.each_pair do |key,val| %>
<% if not @details.registrant_contact.key.nil? %> #This line
<%= key %>:<%= val %>
<% end %>
<% end %>
: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 `'
-:9: syntax error, unexpected $undefined, expecting ']'
puts doc.at_css("body")[\[#include <(\S+)>]\]
matches = doc.at_css("body").text.scan([/#include <\S+>/])
matches.each do |i|
print i
end
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|
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
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:
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
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
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()