Skip to content

Instantly share code, notes, and snippets.

View diogenes's full-sized avatar
:octocat:
Coding...

Diógenes Falcão diogenes

:octocat:
Coding...
View GitHub Profile
@fgbreel
fgbreel / sshd_conf.sh
Created November 19, 2012 16:50
SFTP with OpenSSH
Subsystem sftp "internal-sftp -u 0002"
Match Group sftponly
ChrootDirectory %h
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp -u 0002
@justinko
justinko / Plea.markdown
Created May 30, 2012 19:40
Am I doing it wrong?

Dear Rubyists,

I just lost a contract because of my code in a Rails project.

The specific code in question is related to a "posting a comment" feature. Here are the details:

In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.

The "senior developer", whom is the stake holder's right hand man, said this:

@agnaldo4j
agnaldo4j / chegaDeDesculpas.txt
Created March 2, 2012 11:23
Chega de arrumar desculpas para fazer um trabalho meio boca, assuma sua responsabilidade!
Todos os dias venho lidando com programadores que arrumam desculpas para não realizar um trabalho excelente.
As desculpas geralmente são: chefe não deixa, tenho que entregar logo, isso é assim mesmo ou eu não ganho para isso!
Pois lhes digo que não é assim não.
A seis meses resolvi por a prova todas as técnicas contidas no material que vou passar e tive resultados fantásticos para mim e minha equipe.
Então Minha contribuição para esse assunto são estes 4 livros
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@toshirot
toshirot / websocket-protocol-fallback.js
Created December 4, 2011 00:09 — forked from nicokaiser/websocket-protocol-fallback.js
WebSocket library fallback for old protocol clients
// This code is fallback for https://github.com/Worlize/WebSocket-Node
// add the broadcast to https://gist.github.com/1219165
// 2011.11.30 tato@http://www.facebook.com/javascripting
// Example of how to fallback to alternative websocket library for old protocol clients
// see https://gist.github.com/1148686
var http = require('http'),
WebSocketRequest = require('websocket').request,
@sunaku
sunaku / testr-spin
Created November 9, 2011 18:32
Simple script to emulate Spin using TestR.
#!/usr/bin/env ruby
# This script emulates [Spin] using [TestR].
#
# Usage: testr-spin serve [-I<LOAD_PATH>]... <OVERHEAD_FILE>...
# Usage: testr-spin push <TEST_FILE> [<TEST_NAME>]...
#
# [Spin]: https://github.com/jstorimer/spin
# [TestR]: https://github.com/sunaku/testr
require 'json'
@snatchev
snatchev / gist:1316470
Created October 26, 2011 14:08
resque worker devise not eager loading
❷ > QUEUE=* rake resque:work --trace
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:preload
rake aborted!
No such file to load -- devise/confirmations_controller
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:306:in `rescue in depend_on'
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:301:in `depend_on'
@jswanner
jswanner / after_use_192-patched.sh
Created August 2, 2011 17:46
How to patch ruby for GC tuning and faster requiring
case "$rvm_ruby_string" in
*ruby-1.9.2*-patched)
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
export RUBY_FREE_MIN=$RUBY_HEAP_FREE_MIN
;;
*)
@igrigorik
igrigorik / ruby-1.9-tips.rb
Created February 3, 2011 17:19
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
class BackgroundSessionProxy < Sunspot::SessionProxy::AbstractSessionProxy
class <<self
def async?
!!Thread.current[:background_session_proxy_async]
end
def with_async
self.async = true
begin
yield