Skip to content

Instantly share code, notes, and snippets.

View guilherme's full-sized avatar
🤔

Guilherme Campos guilherme

🤔
View GitHub Profile
@guilherme
guilherme / gist:882116
Created March 22, 2011 21:28
vaga para desenvolvedor na setalabs
Setalabs Contrata estagiário em desenvolvimento web.
Somos uma Startup goiana especializada em desenvolvimento de aplicativos web. Temos um ambiente agradável e salário compatível com o mercado. Atualmente trabalhamos com ruby on rails em todos nossos produtos. Estamos a procura de uma pessoa que tenha facilidade de aprender tecnologias novas.
Requisitos:
- OO
- HTML/CSS fluente
- Javascript
- Ruby(ou que tenha experiência em alguma linguagem de programção OO)
- Rails 2 e 3
- Tenha conhecimento em banco de dados(modelagem, consultas simples)
@guilherme
guilherme / resque_web.monit
Created March 22, 2011 19:31
monit configuration for resque web
check process resque-web with pidfile /var/www/app/shared/resque_web/resque_web.pid
group resque
start program = "/bin/env RAILS_ENV=production /var/www/app/current/app/workers/run_resque_web.sh start" as uid deploy gid deploy
stop program = "/bin/env RAILS_ENV=production /var/www/app/current/app/workers/run_resque_web.sh stop" as uid deploy and gid deploy
if failed host localhost port 5678 with timeout 10 seconds then restart
if 3 restarts within 5 cycles then timeout
function content_changer(container,wrapper, nav_id, baseHeight = 0) {
var newHash = "",
$mainContent = container,
$pageWrap = wrapper,
baseHeight,
$el;
$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() - $mainContent.height();
function content_changer(container,wrapper, baseHeight = 0) {
var newHash = "",
$mainContent = container,
$pageWrap = wrapper,
baseHeight,
$el;
$pageWrap.height($pageWrap.height());
baseHeight = $pageWrap.height() - $mainContent.height();
@guilherme
guilherme / work.sh
Created November 22, 2010 18:02
That's how i optimize my development environment opening. 'my IDE'
gnome-terminal --working-directory=PATH_TO_RAILS_DIRECTORY \
--tab -t 'Development' \
--tab -t 'Log' -e 'tail -f log/development.log' \
--tab -t 'Console' -e 'script/console'
# THIS SNIPPET OPEN A LOG FILE THEN
# SEARCH FOR YOUTUBE LINKS AND GET ALL VIDEO TITLES.
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'open-uri'
youtube_xml_url = "http://gdata.youtube.com/feeds/api/videos/"
youtube_url = "http://youtube.com/watch?v="
class Password < String
POSSIBLE_STRENGTHS = { 1 => "senha fraca", 2 => "senha média", 3 => "senha forte" }
def self.check_strength(password)
strength = 1
if password.length >= 8 || (password.length > 6 && password =~ /[a-z]/ && password =~ /[0-9]/)
strength+=1
end
if password.length > 12 && password =~ /[a-z]/ && password =~ /[A-Z]/ && password =~ /[0-9]/ && password =~ /[^a-zA-Z0-9_\s]/