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
require "rubygems" | |
require "ldap" | |
require "net/ldap" | |
email = "[email protected]" | |
password = "secret" | |
host = "bluepages.ibm.com" | |
treebase = "ou=bluepages, o=ibm.com" | |
filter = "(&(objectClass=person)(mail=#{email}))" |
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
# Classic approach | |
def check_for_truth | |
has_at_least_one_true = false # ewwww temp var | |
[false, false, true].each do |option| | |
has_at_least_one_true = option | |
end | |
has_at_least_one_true | |
end |
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
<% form_for(@user) do |f| %> | |
<p> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</p> | |
<% f.fields_for :custom, @user.custom do |custom_form| %> | |
<% custom_form.object.marshal_dump.each_key do |custom_field| %> | |
<p> | |
<%= custom_form.label custom_field %><br /> |
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
- form_for @products do |form| | |
%h3== Specifications | |
%ul#specifications_container | |
- form.fields_for :specifications do |specification_form| | |
= render :partial => "specification", :locals => { :form => specification_form } | |
%p= add_child_link "Add Specification", :specifications | |
= new_child_fields_template form, :specifications |
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
(function(){ | |
//Adcionando o método digaOla para a classe Date | |
Date.prototype.digaOla = function() { | |
var hora = this.getHours(); | |
if(hora > 00 && hora <= 06) | |
return "Boa madrugada"; | |
else if(hora > 06 && hora <= 12) | |
return "Bom dia"; | |
else if(hora > 12 && hora <= 18) |
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("./")){ |
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 <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> | |
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
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" |
OlderNewer