Skip to content

Instantly share code, notes, and snippets.

@joesavak
joesavak / No gem for me
Created November 11, 2010 22:26
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,
@joesavak
joesavak / dk.rb init
Created November 11, 2010 22:36
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.
@joesavak
joesavak / config.yml
Created November 11, 2010 22:37
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:
#
# ---
@joesavak
joesavak / dk.rb review
Created November 11, 2010 22:40
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'
@joesavak
joesavak / GemMe
Created November 11, 2010 22:44
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...
@joesavak
joesavak / gist:720600
Created November 29, 2010 20:53
twitter_search
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
@joesavak
joesavak / gist:720604
Created November 29, 2010 20:54
performSearch
def index
@search_results = twitter_search('SEARCH KEYWORDS HERE', 10, Time.now.strftime("%Y-%m-%d"))
end
@joesavak
joesavak / gist:720606
Created November 29, 2010 20:55
showTweets
<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 December 6, 2010 20:34
Get files over HTTP
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) -
@joesavak
joesavak / gist:730939
Created December 6, 2010 21:00
XML to DB
<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>