Skip to content

Instantly share code, notes, and snippets.

View No gem for me
C:\Ruby>gem install devise --platform=ruby
Building native extensions. This could take a while...
ERROR: Error installing devise:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,
View dk.rb init
C:\RubyDevKit>ruby dk.rb init
Initialization complete! Please review and modify the auto-generate
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
View config.yml
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
View dk.rb review
C:\RubyDevKit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.
C:/Ruby/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 16, col -2:
' (ArgumentError)
from C:/Ruby/lib/ruby/1.9.1/syck.rb:135:in `load'
from dk.rb:151:in `block in review'
View GemMe
C:\RubyDevKit>gem install devise --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed bcrypt-ruby-2.1.2
Successfully installed devise-1.1.3
2 gems installed
Installing ri documentation for bcrypt-ruby-2.1.2...
Installing ri documentation for devise-1.1.3...
Installing RDoc documentation for bcrypt-ruby-2.1.2...
Installing RDoc documentation for devise-1.1.3...
View gist:720600
def twitter_search(query,rpp,search_day)
base_url = "http://search.twitter.com/search.json"
url = "#{base_url}?q=#{URI.encode(query)}\&rpp=#{rpp}&since=#{search_day}&until=#{search_day}"
data = Net::HTTP.get_response(URI.parse(url)).body
result = JSON.parse(data)
result["results"]
end
View gist:720604
def index
@search_results = twitter_search('SEARCH KEYWORDS HERE', 10, Time.now.strftime("%Y-%m-%d"))
end
View gist:720606
<table>
<%for result in @search_results %>
<tr>
<td><%= auto_link(CGI::unescapeHTML(result["text"])) %></td>
</tr>
<tr>
<td><i>(Follow <a href="http://www.twitter.com/<%= result["from_user"] %>">
<%= result["from_user"]%> </a>)</i></td>
</tr>
<% end %>
@joesavak
joesavak / gist:730902
Created Dec 6, 2010
Get files over HTTP
View gist:730902
for (i = 0; i < _numFiles; i++) {
try {
//get the next file name
fileName = _fileList[i].substring(_fileList[i].lastIndexOf("/")+1);
//associate file (URL) with the httpMethod
HttpMethod getXMLFile = new GetMethod(
_fileList[i]);
//go get the file
_filehttp.executeMethod(getXMLFile );
//header info is useful (modified d/ts & size) -
View gist:730939
<company>
<building address="123 Main Street">Main</building>
<legal name="Main Street productions"/>
<org>
<manager empID=456>Bob Smith</manager>
<employee empID=987>Margie Jones</employee>
<employee empID=721 role="SysAdmin">John Johnson</employee>
</manager>
</org>
</company>