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
(function() { | |
//set up your widget | |
dojo.declare("MyTable", dijit._Widget, { | |
/* | |
* An example of a Refresh method in a widget | |
*/ | |
refresh: function(){ |
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
(function() { | |
//set up your widget | |
dojo.declare("MyTable", dijit._Widget, { | |
postCreate: function(){ | |
this.inherited(arguments); | |
//initialize your default state... |
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
float x = (float) getLocation().getX() / width; | |
float y = (float) (height - getLocation().getY()) / height; | |
float w = (float) getSize().getWidth() / width; | |
float h = (float) getSize().getHeight() / | |
float radius = (w < h) ? w : h; | |
gl.glBegin(GL2.GL_TRIANGLE_FAN); | |
gl.glVertex2f(x, y); | |
for(int i = 0; i<360; i+=5){ | |
gl.glVertex2f(x + (float)Math.sin(i) * radius, y + (float)Math.cos(i) * radius); |
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
test "should create camp" do | |
assert_difference('Camp.count') do | |
post :create, :camp => { | |
:name => "Camp Tester", | |
:uri => "test-camp", | |
:email_address => "test@test.com", | |
:address => { | |
:street_1 => "mccormick rd", | |
:city => "barrer", | |
:state => "MA", |
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 Address < ActiveRecord::Base | |
belongs_to :addressable, :polymorphic => true | |
validates :addressable, :presence => true | |
validates :street_1, :presence => true | |
validates :city, :presence => true | |
validates :state, :presence => true, :length => { :minimum => 2 } | |
validates :zip_code, :presence => true, :zipcode_format => true, :length => { :minimum => 5, :maximum => 10 } | |
validates :country, :presence => true | |
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
/* | |
* Function that handles the drawing of a circle using the triangle fan | |
* method. This will create a filled circle. | |
* | |
* Params: | |
* x (GLFloat) - the x position of the center point of the circle | |
* y (GLFloat) - the y position of the center point of the circle | |
* radius (GLFloat) - the radius that the painted circle will have | |
*/ | |
void drawFilledCircle(GLfloat x, GLfloat y, GLfloat radius){ |
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
/** | |
* This code comes from JeremyMiller on the following thread: | |
* http://bytes.com/topic/javascript/answers/510057-iframe-ie-onload-problem#post3402334 | |
*/ | |
eventPush(document.getElementById('frame_id'),'load',function () {myFrameOnloadFunction();}); | |
function eventPush(obj, event, handler) { | |
if (obj.addEventListener) { | |
obj.addEventListener(event, handler, false); | |
} else if (obj.attachEvent) { |
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 index | |
query = '' | |
queryHash = Hash.new | |
if params[:min_age] | |
append_to_query(query, 'min_age >= :min_age') | |
queryHash[:min_age] = params[:min_age] | |
end | |
if params[:max_age] |
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
scope :open, lambda { | |
joins(:program_populations). | |
where('program_populations.current_population < program_populations.max_population'). | |
group("programs.id") | |
} | |
scope :closed, lambda { | |
joins(:program_populations). | |
where('program_populations.current_population >= program_populations.max_population'). | |
group("programs.id") | |
} |
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
SQL (1.2ms) describe `campers_camps` | |
SQL (1.2ms) describe `campers_camps` | |
Creating scope :open. Overwriting existing method Program.open. | |
Creating scope :open. Overwriting existing method Session.open. | |
Loaded suite functional/camp/programs_controller_test | |
Started | |
SQL (0.1ms) BEGIN | |
SQL (0.7ms) SHOW TABLES | |
Camp Load (0.5ms) SELECT `camps`.* FROM `camps` WHERE (`camps`.`id` = 665138414) LIMIT 1 | |
Processing by Camp::ProgramsController#index as HTML |