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
| source 'http://rubygems.org' | |
| gem 'rails', '3.1.0' | |
| # Bundle edge Rails instead: | |
| # gem 'rails', :git => 'git://github.com/rails/rails.git' | |
| gem 'sqlite3' |
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
| public class Start { | |
| public static void main(String args[]) { | |
| System.out.println("x, y: " + (7 - 6) + ", " + (3 - 4)); | |
| System.out.println((Math.pow((7 - 6), 2) + Math.pow((3 - 4), 2))); | |
| System.out.println("x, y: " + (7 - 6) + ", " + (3 - 2)); |
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
| public class MouseRobot { | |
| private void mouseRebotReplace(MouseEvent e) { | |
| int x = e.getX() - pCenterX; | |
| int y = e.getY() - pCenterY; | |
| if (!isPaused) { | |
| if (mouseX < 0) { | |
| mouseX = 0; | |
| } else if (mouseX > pWidth) { |
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
| # encoding: utf-8 | |
| class PhotoUploader < CarrierWave::Uploader::Base | |
| # Include RMagick or ImageScience support: | |
| include CarrierWave::RMagick | |
| # include CarrierWave::ImageScience | |
| # Choose what kind of storage to use for this uploader: | |
| if RAILS_ENV == "development" | |
| storage :file |
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
| module ApplicationHelper | |
| # A nice way to help the views tell if you are on the current page you want to be on. | |
| def current_view(params, options = {}) | |
| results = options[:result] || "true" | |
| valid = true | |
| options.each do |option| | |
| for param in params |
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
| # Filters added to this controller apply to all controllers in the application. | |
| # Likewise, all the methods added will be available for all controllers. | |
| # Make sure that all the methods that redirect are handled in the controllers. | |
| class ApplicationController < ActionController::Base | |
| include AuthenticatedSystem | |
| include Userstamp | |
| include ExceptionLoggable | |
| local_addresses.clear |
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
| class ErrorFormBuilder < ActionView::Helpers::FormBuilder | |
| #Adds error message directly inline to a form label | |
| #Accepts all the options normall passed to form.label as well as: | |
| # :hide_errors - true if you don't want errors displayed on this label | |
| # :additional_text - Will add additional text after the error message or after the label if no errors | |
| def label(method, text = nil, options = {}) | |
| #Check to see if text for this label has been supplied and humanize the field name if not. | |
| text = text || method.to_s.humanize | |
| #Get a reference to the model object | |
| object = @template.instance_variable_get("@#{@object_name}") |
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
| namespace :images do | |
| require 'action_controller' | |
| require 'action_controller/test_process.rb' | |
| require 'find' | |
| desc "Imports all the images into the database as well as formats the for your use." | |
| task :import => :environment do | |
| cards = Array.new | |
| Card.find(:all).map do |t| | |
| cards << ["#{t.name}"] |
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
| class ApplicationController < ActionController::Base | |
| before_filter :set_current_user | |
| protected | |
| def set_current_user | |
| # Call in model with User.current_user | |
| User.current_user = self.current_user | |
| end | |
| end |
NewerOlder