This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.strip_html = function() { | |
var tmp = document.createElement("DIV"); | |
tmp.innerHTML = this; | |
return tmp.textContent || tmp.innerText; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/*.css' do | |
content_type 'text/css', :charset => 'utf-8' | |
sass params[:splat].join.to_sym | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=gradient($from, $to) | |
/* fallback/image non-cover color */ | |
background-color: $from | |
/* Firefox 3.6+ */ | |
background-image: -moz-linear-gradient($from, $to) | |
/* Safari 4+, Chrome 1+ */ | |
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'activesupport' | |
# Lorem Ipsum | |
words = %w{lorem ipsum dolor sit amet consectetuer adipiscing elit phasellus hendrerit pellentesque aliquet nibh nec urna in nisi neque vel dapibus id mattis sed pretium ligula sollicitudin laoreet viverra tortor libero sodales leo eget blandit nunc eu nullam mollis ut justo suspendisse potenti egestas ante et vulputate volutpat eros pede semper est vitae luctus metus augue morbi purus faucibus commodo quis gravida lectus praesent elementum at felis vestibulum lacus a ultrices sagittis mi euismod dui pulvinar sapien ornare nisl arcu fermentum interdum ac risus lacinia magna ullamcorper facilisis mauris varius tellus etiam ultricies integer fusce accumsan diam vehicula sem massa malesuada non congue scelerisque vivamus tristique iaculis imperdiet feugiat convallis odio aliquam posuere nulla quisque cum sociis natoque penatibus magnis dis parturient montes nascetur ridiculus mus condimentum dignissim proin donec curabitur} | |
@words = words.reject { |word| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
class ActiveRecord::Base | |
def self.magic! | |
connection.tables.map { |table| | |
klass = Class.new(self) | |
Object.send(:const_set, table.singularize.camelize, klass) | |
}.each { |model| | |
model.column_names.grep(/_id$/).each { |foreign_key| | |
name = foreign_key.sub(/_id$/, '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Inside the helper file that uses it. | |
class Spitter | |
include ActionView::Helpers::TagHelper | |
include ActionView::Helpers::TextHelper | |
include ActionView::Helpers::UrlHelper | |
def initialize(klass) | |
@klass = klass | |
end |
NewerOlder