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 CanAccessSomeGem | |
def self.matches?(request) | |
current_user = request.env['warden'].user | |
return false if current_user.blank? | |
return < some condition on current_user > | |
end | |
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
@available_fetchers = Fetcherr.all | |
if @available_fetchers.empty? | |
puts "No fetchers found" | |
else | |
@available_fetchers.each do |fetcher| | |
puts "Loading the #{fetcher.name} fetcher" | |
eval("#{fetcher.name} = Class.new()") | |
klass = Class.new |
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 Link | |
attr_reader :url | |
def initialize(url) | |
@url = url | |
end | |
def bad? | |
return false if link.blank? | |
(GlobalPreference.get('suspicious_words') + GlobalPreference.get('bad_words')).any? { |word| url =~ eval("/#{word.strip}/") } |
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 Link | |
attr_reader :url | |
def initialize(url) | |
@url = url | |
end | |
def bad? | |
return false if link.blank? | |
(GlobalPreference.get('suspicious_words') + GlobalPreference.get('bad_words')).any? { |word| url =~ eval("/#{word.strip}/") } |
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
# include at least one source and the rails gem | |
source :gemcutter | |
gem "rails", "~> 2.3.5", :require => nil | |
gem "sqlite3-ruby", :require => "sqlite3" | |
group :development do | |
# bundler requires these gems in development | |
gem 'rails-footnotes' | |
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
module AssignmentsHelper | |
def assignment_statistics_probability | |
# (@assignments.map {|assignment| assignment.probability_grade }.inject(:+) / (@assignments.length.to_f * 12)) * 100 | |
(@assignments.collect(&:probability_grade).sum / (@assignments.length.to_f * 12)) * 100 | |
end | |
def assignment_statistics_geometry | |
(@assignments.map {|assignment| assignment.geometry_grade }.inject(:+) / (@assignments.length.to_f * 12)) * 100 | |
end | |
def assignment_statistics_weeks | |
@assignments.length |
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/sh | |
# setup ------------------------------------------------------------------------ | |
tempDir="/tmp/`whoami`/chrome-nightly/"; | |
baseURL="http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/"; | |
baseName="chrome-mac"; | |
baseExt="zip"; | |
appName="Chromium.app"; | |
appDir="/Applications"; | |
version=~/.CURRENT_CHROME; |
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
$('form').submit(function(){ | |
$('input[type=image]', this).attr({disabled:'disabled'}); | |
}); |
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
$('form').submit(function(){ | |
$('input[type=image]', this).attr({disabled:'disabled'}); | |
}); |
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
<p> | |
<%= form.label :name %><br /> | |
<%= form.text_field :name %> | |
</p> | |
<p> | |
<%= form.label :street_address1 %><br /> | |
<%= form.text_field :street_address1 %> | |
</p> | |
<p> |