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 someMethod(blah) | |
# Do some stuff | |
if somecondition | |
var1 | |
else | |
var2 | |
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
# Does this perform a single query with the filters or does it perform the first part and filter within Ruby after? | |
Zombie.where(:type => "Left 4 Dead").order(:name).limit(2) |
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 for a table called "zombies" in MySQL with some columns | |
class Zombie < ActiveRecord::Base | |
validates_presence_of :name #name column must exist before saving to DB | |
validates_uniqueness_of :name #names must be unique | |
has_many :weapons #The weapons table will have a column describing ownership by zombies | |
end | |
# Class for "weapons" table | |
class Weapon < ActiveRecord::Base | |
belongs_to :zombie #Other half of ownership, column will be called "zombie_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
def somemethod | |
# do stuff! | |
if somecondition | |
value | |
elsif another_condition | |
somethingelse | |
else | |
anothervalue | |
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
# Renders "tags/form" with the @form instance variable defined | |
<%= render :partial => 'tags/form', | |
:locals => {:form => post_form} %> | |
# Renders "customer"; the value in :object is defined as a local variable customer in the partial | |
<%= render :partial => "customer", :object => @new_customer %> |
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 "mpi.h" | |
#include <stdio.h> | |
#include <math.h> | |
int main( int argc, char *argv[]) | |
{ | |
int n, i, k; | |
double PI25DT = 3.141592653589793238462643; | |
double pi, h, sum, x, recv_sum; |
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 "mpi.h" | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
int numprocs, myid; | |
int rows; | |
int pagesPerProcessor; | |
int begin; | |
int pageCount; |
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
{- | |
- Author: Michael Kelly, mkelly01@my.fit.edu | |
- Course: CSE 4510, Spring 2011 | |
- Project: game, The Triangle Game | |
-} | |
module Main where | |
import List(delete) | |
-- Main 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
#include "mpi.h" | |
#include <stdio.h> | |
double getInMat(double* matrix, int width, int col, int row) { | |
return matrix[(row * width) + col]; | |
} | |
void setInMat(double* matrix, int width, int col, int row, double val) { | |
matrix[(row * width) + col] = 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
{- | |
- Author: Michael Kelly, mkelly01@my.fit.edu | |
- Course: CSE 4510, Spring 2011 | |
- Project: endo1, Saving Endo, Part I | |
-} | |
module Main where | |
-- Main function | |
main :: IO() |
OlderNewer