Skip to content

Instantly share code, notes, and snippets.

@dkharrat
dkharrat / MarkItUpInlineUpload.js
Created January 18, 2011 03:29
upload feature for markitup...copied from http://pastebin.ca/1763467 as pastebin.ca seems to be down.
// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Html tags
// http://en.wikipedia.org/wiki/html
// ----------------------------------------------------------------------------
// Basic set. Feel free to add more tags
@dkharrat
dkharrat / Article.rb
Created June 15, 2011 08:44
Sphinx test with STI models
# == Schema Information
#
# Table name: posts
#
# id :integer(4) not null, primary key
# title :string(255)
# author :text
# content :text
# state :text
# type :text
@dkharrat
dkharrat / Enumeration.rb
Created May 7, 2012 19:09
Enumerations in ruby
# credit goes to http://stackoverflow.com/questions/265725/what-is-the-best-way-to-handle-constants-in-ruby-when-using-rails
class Enumeration
def self.def_enum(key,value)
@hash ||= Hash.new { |hash, key| raise NameError, "#{self.name}::#{key} is not defined" }
@hash[key] = value
end
def self.const_missing(key)
@hash[key]
end