Skip to content

Instantly share code, notes, and snippets.

View joeletizia's full-sized avatar

Joe Letizia joeletizia

View GitHub Profile
@joeletizia
joeletizia / parameterize-demo.rb
Created April 21, 2013 23:23
A demo of parameterize function in ActiveSupport
"Joe Letizia's awesome blog 2.0".parameterize
# => "joe-letizia-s-awesome-blog-2-0"
require 'active_record'
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.colorize_logging = false
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => ":memory:"
)
@joeletizia
joeletizia / Logger.cs
Created February 21, 2013 16:56
Logging class
public class SubordinateLoggingContext
{
private static string CONNECTIONSTRING = "mongodb://connotate:connotate@linus.mongohq.com:10002/ConnotateLogs";
MongoServer mongo;
MongoDatabase db;
MongoCollection collection;
public SubordinateLog log;
public SubordinateLoggingContext()
@joeletizia
joeletizia / Winter-func.rb
Created February 6, 2013 02:10
A solution (at least I think it's right...) to http://challenge.signpost.com/leveltwo The Ransom Glad you've made it this far, intrepid friend of Max. To tell you a little about ourselves, our goal is to end winter in Chicago. We've read our Ries and plan to start small, with an MVP. We currently have the resources to build a structure covering …
require 'open-uri'
def adj_sum(multi,x,y)
sum = multi[x][y].to_i
if x > 0
sum += multi[x-1][y].to_i
end
if x < 999