Skip to content

Instantly share code, notes, and snippets.

View georgeguimaraes's full-sized avatar
💭
🧰

George Guimarães georgeguimaraes

💭
🧰
View GitHub Profile
class Product < ActiveRecord::Base
end
http://cms.site.mydomain.com/cms/login
POST /cms/login HTTP/1.1
Host: cms.site.mydomain.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10
find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec
touch {}/.gitignore \;
@georgeguimaraes
georgeguimaraes / deploy.rb
Created September 11, 2009 18:30
Receita simples de Capistrano. É a minha base pra todos os projetos.
set :application, "myapp"
set :keep_releases, 5
# git options
set :scm, "git"
set :repository, "git://github.com/georgeguimaraes/myapp.git"
set :branch, "master"
set :deploy_via, :remote_cache
# deploy credentials
# collect information about a running process
# ruby debug.rb <pid>
begin
raise ArgumentError unless pid = ARGV[0]
pid = pid.to_i
Process.kill(0,pid)
rescue TypeError, ArgumentError
raise 'pid required'
rescue Errno::ESRCH
/*
* is this cool enough that it warrants a blog post?
*
* trigger breakpoint in GDB, from code.
*/
#include <stdio.h>
int main(int argc, char *argv[]) {
class CanonicalHost
def initialize(app, host=nil, &block)
@app = app
@host = (block_given? && block.call) || host
end
def call(env)
if url = url(env)
[301, { 'Location' => url }, ['Redirecting...']]
else

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
Rails CMS alternatives
======================
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
"the cutting edge Rails CMS platform"
require 'rubygems'
require 'atom'
xhtml = Atom::Content::Xhtml.new("<p>Some text</p>")
entry = Atom::Entry.new do |e|
e.title = "some title"
e.updated = 12345
e.content = xhtml
end