Skip to content

Instantly share code, notes, and snippets.

View lastk's full-sized avatar

Rafael Oliveira lastk

  • Salvador-Ba, Brazil
View GitHub Profile
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)
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
@lastk
lastk / gist:2413388
Created April 18, 2012 12:50 — forked from kurko/gist:2410930
DCI in real code
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
$(document).ready(function() {
if ($("[name='search']").length) {
$("[name='search']").each(function() {
var search = new Search.Input(this);
search.setBindings();
});
}
});

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

@lastk
lastk / hook.rb
Last active August 29, 2015 14:13 — forked from dce/gist:44754
simple git commit hook
#!/usr/bin/ruby
require 'rubygems'
require 'git'
log = "~/gitlog.txt"
tmp = "/tmp/gitlog"
commit = Git.open('.').log.first
message = [
commit.date.strftime('%D'),
@lastk
lastk / -
Created October 14, 2015 00:40
app/concepts/
|-- address
| `-- create_form.rb
|-- admin_user
| |-- create.rb
| `-- update.rb
|-- auto_investments
| `-- investment
| |-- create.rb
| |-- update.rb
@lastk
lastk / TextTypeExtension.php
Created February 21, 2017 02:13 — forked from simshaun/TextTypeExtension.php
Symfony TextTypeExtension
<?php
namespace PlatformBundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
@lastk
lastk / must-watch-talks.txt
Created July 4, 2017 14:56 — forked from leandrocp/must-watch-talks.md
must-watch talks
Rich Hickey
https://confreaks.tv/videos/railsconf2012-keynote-simplicity-matters
https://confreaks.tv/videos/jaxconf2012-keynote-the-value-of-values
Dave Thomas
https://confreaks.tv/videos/elixirconf2014-opening-keynote-think-different
https://confreaks.tv/videos/lonestarruby2013-elixir-power-of-erlang-joy-of-ruby
Robert Martin
https://confreaks.tv/videos/rubymidwest2011-keynote-architecture-the-lost-years
@lastk
lastk / introrx.md
Created October 27, 2017 12:49 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing