Skip to content
View hook.rb
#!/usr/bin/ruby
require 'rubygems'
require 'git'
log = "~/gitlog.txt"
tmp = "/tmp/gitlog"
commit = Git.open('.').log.first
message = [
commit.date.strftime('%D'),
View gist:40713bd14864c625682f

Overview

We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.

Analytics

View contato_news.rb
#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'
View gist:7845935
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
*.pdb
*.dll.config
*.cache
View gist:5137665
$(document).ready(function() {
if ($("[name='search']").length) {
$("[name='search']").each(function() {
var search = new Search.Input(this);
search.setBindings();
});
}
});
View gist:2413388
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
View gist:2407839
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
View gist:2407666
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)
View macenv.rb
#!/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">
View gist:1075145
=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
Something went wrong with that request. Please try again.