This file contains 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
document.location = $('.gallery-holder ul li:nth-child( ' + (parseInt( $('#controls .current')[0].id.replace(/[^0-9]/g, '')) + 1) + ') a').attr('href'); |
This file contains 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
# Select distinct category names that are being used on associated NewsArticle | |
# model and sort by name. | |
NewsArticle.all(:joins => :category, :order => 'categories.name', | |
:select => "DISTINCT(categories.name)") |
This file contains 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
RewriteEngine on | |
RewriteCond $1 !^(images|cms|themes|favicon\.ico|robots\.txt|index\.php) [NC] | |
RewriteRule ^(.*)$ /index.php/$1 [L] |
This file contains 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
// TRENT RICHARDSON | |
// http://trentrichardson.com/2009/01/08/getting-a-list-of-checkbox-values-with-jquery/ | |
jQuery.fn.getCheckboxVal = function(){ | |
var vals = []; | |
var i = 0; | |
this.each(function(){ | |
vals[i++] = jQuery(this).val(); | |
}); | |
return vals; |
This file contains 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
// http://jsfiddle.net/uhNQX/ | |
var NS = (function(){ | |
var something = "hi"; | |
return { | |
alert_something : function(){ | |
alert( something ); | |
} | |
} | |
}()); |
This file contains 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_support/inflector' | |
puts "so_very_nifty".titleize # => "So Very Nifty" | |
# ActiveSupport::CoreExtensions::String::Inflections documentation: | |
# http://rails.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html |
This file contains 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 'nokogiri' | |
# retrive unique values of category in an XML document | |
# doc is an Nokogiri::XML::Document | |
# (http://nokogiri.org/Nokogiri/XML/Document.html) | |
@doc.css('category').to_a.map { |c| c.content }.uniq | |
# css('category') # get all <category> nodes | |
# to_a # convert to an array |
This file contains 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
def articles_list | |
articles = @items.select { |i| i.path.match(/reading_room\/.+/) unless i.path.nil? } | |
articles_by_category = {} | |
# organize by category | |
articles.each do |article| | |
articles_by_category[article[:category]] ||= [] | |
articles_by_category[article[:category]].push article | |
end |
This file contains 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
$("input.dollars, input.number, input.percentage").blur(function(){ | |
// VALIDATE | |
var input = $(this); | |
if (input.val() == "") input.val("0"); | |
if (input.attr("data-min") != undefined && input.attr("data-max") != undefined){ | |
var min = parseInt(input.attr("data-min")); | |
var max = parseInt(input.attr("data-max")); | |
var val = parseInt(input.val()); |
This file contains 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
DoubleAnimation animation = new DoubleAnimation(); | |
animation.To = 0; | |
//animation.From = 1; | |
animation.Duration = TimeSpan.FromMilliseconds(ANIMATION_SPEED); | |
animation.EasingFunction = new QuadraticEase(); | |
Storyboard sb = new Storyboard(); | |
sb.Children.Add(animation); | |
c.Opacity = 1; |