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
class Avatar < ActiveRecord::Base | |
has_attachment :content_type => :image, | |
:storage => :file_system, | |
:max_size => 500.kilobytes, | |
:resize_to => 'c128x128', | |
:thumbnails => {:tiny => 'c24x24', :small => "c48x48"} | |
validates_as_attachment | |
after_validation :greeklize_attachment_errors | |
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
<tr class="marked"> | |
<td colspan="5"><pre><a name="line6"></a>6 def toc_for(article)</pre></td> | |
</tr> | |
<tr class="uncovered"> | |
<td colspan="5"><pre><a name="line7"></a>7 '<ul id="toc_links">' + article.toc.collect{ |h5|</pre></td> | |
</tr> | |
<tr class="uncovered"> | |
<td colspan="5"><pre><a name="line8"></a>8 '<li>' + link_to(h5[:title], url_for_article(article) + '?article_page=' + h5[:page].to_s + '#' + h5[:id]) + '</li>'</pre></td> | |
</tr> | |
<tr class="uncovered"> |
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
# used for paginations (Model.paginate :page => page_from_params) | |
# it just makes the WillPaginate::InvalidPage errors go away | |
def page_from_params | |
(p = params[:page].to_i) > 0 ? p : 1 | |
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
$$('a[data-remote=true]').each(function(a){ | |
a.onclick = function(){ | |
href = a.getAttribute('href'); | |
url = href.split('?')[0]; | |
params = href.split('?')[1]; | |
newParam = encodeURI(eval(a.getAttribute('data-with'))); | |
if(params){ | |
params = params.split('&'); |
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 all_controller_actions(controller) | |
(controller.ancestors[1, controller.ancestors.index(ApplicationController)] + [Object]).inject(controller.new.methods) do |methods, ancestor| | |
methods -= ancestor.new.methods unless ancestor.class == Module | |
methods | |
end.reject{|m| m =~ /^_/}.sort.map(&:to_sym) | |
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
git log -p --color $(git merge-base master branch)...master path/to/file.rb |
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
#!/bin/bash | |
# checks for GCC (installed from Xcode) | |
if [ "$(which gcc)" = "" ]; then | |
echo "You don't have Xcode installed. Please install it from http://developer.apple.com/" | |
exit 0 | |
fi | |
# checks for git | |
if [ "$(which git)" = "" ]; then |
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
Gw0whe$PfehwH{W%$%0sfwFGOENqi24yHSFP{NKFwekqzcxGPAEGMq32pfewkjnwrHN}#%Fwedqkdg?WM43\hgwr#$JhowdnwqQELFDWmenhwREWKwqeq$ |
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
git grep -n ':focus *=> *true' -- $(ruby -e 'puts `ls -d spec/*`.split("\n").reject{|f| f == "spec/spec_helper.rb"}') |
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
ruby ../cleanup_gist/merged_branches.rb > ../cleanup_gist/table.txt && cat ../cleanup_gist/table.txt |
OlderNewer