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
gem 'devise', '~> 1.1.2' | |
gem 'cancan' | |
generate 'devise:install' |
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
Sass::Plugin.options[:template_location] = "#{Rails.root}/app/styles" => "#{Rails.root}/tmp/stylesheets" | |
Rails.configuration.middleware.insert_after "Sass::Plugin::Rack", "Rack::Static", :urls => ["/stylesheets"], :root => "#{Rails.root}/tmp" |
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
# Ruby way fail | |
# Implementation of a simple method to convert seconds to time format (03:44:23) | |
require "benchmark" | |
seconds = 45020 | |
hours = seconds / 3600 | |
minutes = seconds / 60 % 60 |
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
1.upto 500 do | |
Class.new do | |
1.upto 1000 do |method_number| | |
method_name = "method_#{method_number}" | |
instance_eval "# Hi I am a comment for #{method_name}" | |
attr_accessor method_name.to_sym | |
end | |
["click", "mousedown", "mouseenter", "mouseleave", "mouseout", "mouseover", "mouseup"].each do |event| | |
define_method event.to_sym do | |
"Hi I am on #{event}" |
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
<?php | |
function sendEmailViaWebService($email) { | |
$soapClient = new soapclient("http://www.paulinia.sp.gov.br/email/sendmail.asmx?WSDL", "wsdl"); | |
$request = "<Send xmlns='http://tempuri.org/'> | |
<De>{$email['from']}</De> | |
<Para>{$email['to']}</Para> | |
<Assunto>{$email['subject']}</Assunto> | |
<Mensagem>{$email['message']}</Mensagem> | |
</Send>"; |
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
Dim Connection As New SqlConnection() | |
Dim Command As New SqlCommand() | |
Dim Result As SqlDataReader | |
Connection.ConnectionString = "Data Source=myserver;Initial Catalog=databasename;Integrated Security=True" | |
Connection.Open | |
Command.Connection = Connection | |
Command.CommandText = "SELECT * FROM users" |
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
#include <stdio.h> | |
int main() | |
{ | |
char *students[3]; | |
int iterator; | |
students[0] = "Thiago"; | |
students[1] = "Gustavo"; | |
students[2] = "Thomas"; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
printf("%i\n", factorial(atoi(argv[1]))); | |
} | |
int factorial(int number) | |
{ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
return copy(open_file_for_reading(argv[1]), open_file_for_writing(argv[2])); | |
} | |
int copy(FILE *source_file, FILE *target_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
#include <stdio.h> | |
#include <dirent.h> | |
#include <sys/types.h> | |
int main (void) | |
{ | |
DIR *directory; | |
struct dirent *current_file; | |
if(directory = opendir("./")){ |