Skip to content

Instantly share code, notes, and snippets.

View marcelloma's full-sized avatar

Marcello Albuquerque marcelloma

View GitHub Profile
class Partner
include Mongoid::Document
include Mongoid::Timestamps
field :contact_first_name
field :contact_last_name
end
module Administration
class PartnersController < BaseController
respond_to :html
def index
authorize! :read, :partners
@partners = Partner.page(params[:page])
respond_with @partners
end
@marcelloma
marcelloma / gist:3404604
Created August 20, 2012 14:11
webkit-debug
Finished "EnableLogging"
Wrote response true ""
Received "Visit"
Started "Visit"
Load started
"Visit" started page load
Started request to "http://127.0.0.1:57733/store/signin"
Finished "Visit"
Started request to "http://127.0.0.1:57733/assets/application.js"
Received 200 from "http://127.0.0.1:57733/store/signin"
module Messenger
class Person
@@people = []
def initialize(attributes={})
@attributes = { :global_id => nil, :name => nil }.merge(attributes)
end
def self.create!(attributes={})
@marcelloma
marcelloma / myapp.rb
Created October 11, 2011 17:37
Actions
get '/login' do
haml :login
end
post '/login' do
player = Player.first_or_create(:name => params[:player_name])
session[:player] = player.name
redirect '/lobby'
end
@marcelloma
marcelloma / applicatio.coffee
Created October 11, 2011 17:24
coffescript
window.client = new Faye.Client('/faye')
window.subscribe_to_game_channel = (player, game_id) ->
subscription = client.subscribe "/games/#{game_id}", (message) ->
$('.messages').append message.text
$ ->
alert('teste')
@marcelloma
marcelloma / spec_helper.rb
Created September 30, 2011 17:33
Spec Helper
require 'rubygems'
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
@marcelloma
marcelloma / gist:1232711
Created September 21, 2011 17:22
Deploy2
DEBUG search: sets_user_path:/home/unicorn/.sm/sets:
DEBUG search: exts_user_path:/home/unicorn/.sm/exts:
DEBUG search: extensions_search_paths:/home/unicorn/.sm/exts/active /opt/sm/exts/active /opt/sm/sets/active/ruby /opt/sm/sets/active/tools /opt/sm/core:
DEBUG search: preload sm/core in core/sm/shell/core.
DEBUG search: preload sm/string in core/internal/shell/string.
DEBUG search: preload sm/logging in core/sm/shell/logging.
DEBUG search: preload sm/command in core/sm/shell/command.
DEBUG search: preload sm/modules in core/sm/shell/modules.
DEBUG search: preload sm/versionedfs in core/sm/shell/versionedfs.
DEBUG search: module api/extensions/detection in core/api/shell/extensions/detection.
@marcelloma
marcelloma / gist:1232706
Created September 21, 2011 17:21
Deploy2
DEBUG search: sets_user_path:/home/unicorn/.sm/sets:
DEBUG search: exts_user_path:/home/unicorn/.sm/exts:
DEBUG search: extensions_search_paths:/home/unicorn/.sm/exts/active /opt/sm/exts/active /opt/sm/sets/active/ruby /opt/sm/sets/active/tools /opt/sm/core:
DEBUG search: preload sm/core in core/sm/shell/core.
DEBUG search: preload sm/string in core/internal/shell/string.
DEBUG search: preload sm/logging in core/sm/shell/logging.
DEBUG search: preload sm/command in core/sm/shell/command.
DEBUG search: preload sm/modules in core/sm/shell/modules.
DEBUG search: preload sm/versionedfs in core/sm/shell/versionedfs.
DEBUG search: module api/extensions/detection in core/api/shell/extensions/detection.
@marcelloma
marcelloma / gist:1232541
Created September 21, 2011 16:26
Deploy fail
unicorn@urano:~$ sm --trace deploy
/opt/sm/exts/active/deploy/shell//initialize:27: scalar parameter previous_releases created globally in function
/opt/sm/exts/active/deploy/shell//initialize:29: scalar parameter previous created globally in function
/opt/sm/exts/active/deploy/shell//initialize:38: array parameter deploy_steps created globally in function
+/opt/sm/core/sm/shell/log/functions:432 __sm.actions.call():6 > do_deploy
+/opt/sm/exts/active/deploy/shell//functions:318 do_deploy():3 > export 'log_file=/home/unicorn/shared/log/deploy/09.21.2011T13:19:45/deploy.log'
+/opt/sm/exts/active/deploy/shell//functions:320 do_deploy():5 > tee -a /home/unicorn/shared/log/deploy/09.21.2011T13:19:45/deploy.log