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
#model | |
require 'csv' | |
class ContatoNews < ActiveRecord::Base | |
paginates_per 9 | |
validates_format_of :email, | |
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, | |
:message => 'email must be valid' |
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
################### | |
# compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.pdb | |
*.dll.config | |
*.cache |
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
$(document).ready(function() { | |
if ($("[name='search']").length) { | |
$("[name='search']").each(function() { | |
var search = new Search.Input(this); | |
search.setBindings(); | |
}); | |
} | |
}); |
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
class ReceivablesManagementContext | |
def initialize(params) | |
@params = params | |
end | |
def save_receivable | |
sanitize_controller_params | |
@receivable = AccountReceivable.new(@params[:account_receivable]) | |
@receivable.customer_id = @params[:customer_id] | |
@receivable.save |
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
class PostCommitmentContext | |
#how we're using ruby/rails I thought in something like a rubygem and have a 'config' file in other place. | |
twitterable[:twitterFollower,:twitterPoster] | |
def initialize(params) | |
@params = params | |
end | |
def save |
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
class PostCommitmentContext | |
def initialize(params) | |
@params = params | |
end | |
def save | |
@post = Post.new(@params) | |
if @post.save | |
# @post é ActiveRecord, então não há o que extender mesmo porque ActiveRecord já está encruado | |
Twitter.send_notification({login: "login",pass:"password"},@post.title) |
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
#!/usr/bin/env ruby | |
PASS_THROUGH = %w(PATH MANPATH EDITOR) | |
DIRECTORY = File.expand_path('~/.MacOSX') | |
FILENAME = File.join(DIRECTORY, 'environment.plist') | |
Dir.mkdir(DIRECTORY) unless File.exist?(DIRECTORY) | |
HEADER = <<EOT | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
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_session,:url=>"/sessions",:method=>"post") do |f| | |
.field | |
=f.label :credential | |
=f.text_field :credential | |
.field | |
= f.label :password | |
= f.text_field :password | |
.field.actions |
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
<!-- layout file --> | |
<% if current_user %> | |
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %> | |
<% else %> | |
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>. | |
<% 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
function escapeString(string) { | |
string = string.replace(/\\/g, "\\\\"). | |
replace(/\n/g, "\\n"). | |
replace(/\r/g, "\\r"). | |
replace(/\t/g, "\\t"); | |
if (string.indexOf("'") < 0) { | |
return "'" + string + "'"; | |
} | |
string = string.replace(/"/g, "\\\""); | |
return '"' + string + '"'; |