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 Particpant < AR::Base | |
delegate :require_name?, :require_email?, :require_phone?, :to => :project, :allow_nil => true | |
with_options :on => :update do | |
validates_presence_of :name, :if => :require_name? | |
validates_presence_of :email, :if => :require_email? | |
validates_presence_of :phone, :if => :require_phone? | |
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
class Email | |
def initialize(address) | |
@address = address | |
end | |
def address | |
@address.strip | |
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
class EmailCollection | |
include Enumerable | |
delegate :each, :to => :email_addresses | |
def initialize(raw_email_addresses) | |
@raw_email_addresses = raw_email_addresses | |
end | |
def valid_emails | |
select {|e| e.match(email_regex) } |
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 Bar | |
def initialize(name) | |
@name = name | |
end | |
def to_str | |
@name | |
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
int main(int argc, char *argv[]) | |
{ | |
int val = 5; | |
switch(val) { | |
case 0: do { | |
case 5: | |
printf("Got here, value is %d\n", val); | |
case 4: | |
printf("Got here, value is %d\n", 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
#include <stdio.h> | |
int | |
main (int argc, char *argv[]) | |
{ | |
char *name = "Patrick"; | |
char *other = name; | |
printf("Name is: %s\n", name); | |
printf("Other is: %s\n", other); |
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 <stdlib.h> | |
#include <stdio.h> | |
int | |
main(int argc, char *argv[]) | |
{ | |
if (argc <= 1) { | |
printf("Error: You must supply a value\n"); | |
return 1; | |
} |
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 <stdlib.h> | |
#include <string.h> | |
char * | |
str_upcase(char *source) | |
{ | |
int i = 0; | |
int shift = 0; | |
char ch = '\0'; |
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 HealthCheck | |
class Middleware | |
def initialize(application) | |
@application = application | |
end | |
def call(environment) | |
if environment['PATH_INFO'] == '/health-check' | |
if HealthCheck.healthy? |
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
main | |
*.o |