This file contains 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
pt-BR: | |
formtastic: | |
:yes: 'Sim' | |
:no: 'Não' | |
:create: 'Criar %{model}' | |
:update: 'Atualizar %{model}' | |
:submit: 'Salvar %{model}' | |
:cancel: 'Cancelar %{model}' | |
:reset: 'Resetar %{model}' | |
:required: 'obrigatório' |
This file contains 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
pt-BR: | |
formtastic: | |
:yes: 'Sim' | |
:no: 'Não' | |
:create: 'Criar %{model}' | |
:update: 'Atualizar %{model}' | |
:submit: 'Salvar %{model}' | |
:cancel: 'Cancelar %{model}' | |
:reset: 'Resetar %{model}' | |
:required: 'obrigatório' |
This file contains 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
namespace :admin do | |
resources :users, only: [:show] do | |
collection do | |
get :search | |
end | |
end | |
end |
This file contains 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
@retained = [] | |
@rand = Random.new(999) | |
MAX_STRING_SIZE = 100 | |
def stress(allocate_count, retain_count, chunk_size) | |
chunk = [] | |
while retain_count > 0 || allocate_count > 0 | |
if retain_count == 0 || (@rand.rand < 0.5 && allocate_count > 0) | |
chunk << " " * (@rand.rand * MAX_STRING_SIZE).to_i |
This file contains 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
# config/unicorn.rb | |
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) | |
timeout 15 | |
preload_app true | |
before_fork do |server, worker| | |
Signal.trap 'TERM' do | |
puts 'Unicorn master intercepting TERM and sending myself QUIT instead' | |
Process.kill 'QUIT', Process.pid | |
end |
This file contains 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
WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit: | |
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering | |
Please consider upgrading to ruby-2.1.2 which will have all of the latest security patches. |
This file contains 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
jQuery.fn.preventDoubleSubmission = function() { | |
$(this).on('submit',function(e){ | |
var $form = $(this); | |
if ($form.data('submitted') === true) { | |
e.preventDefault(); | |
} else { | |
$form.data('submitted', true); | |
} | |
}); |
This file contains 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 Post | |
def as_indexed_json(options={}) | |
self.as_json( | |
only: [ :id, :title, :published ], | |
filter: { | |
bool: { | |
should: { | |
term: { published: true } | |
} | |
} |
This file contains 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
location ~ ^/(assets)/ { | |
root /path/to/public; | |
gzip_static on; # to serve pre-gzipped version | |
expires max; | |
add_header Cache-Control public; | |
} |
This file contains 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
<div class="fb-like" data-href="https://www.facebook.com/riostartups" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div> | |
<div id="fb-root"></div> | |
<script>(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; | |
js = d.createElement(s); js.id = id; | |
js.src = "//connect.facebook.net/en/sdk.js#xfbml=1&appId=227914187387923&version=v2.0"; | |
fjs.parentNode.insertBefore(js, fjs); |