Skip to content

Instantly share code, notes, and snippets.

View dwaynemac's full-sized avatar

Dwayne Macgowan dwaynemac

View GitHub Profile
PadmaContact.search(ids: a,username:'luis.perichon',account_name:'martinez2112052')
LogicalModel Log: 200 https://padma-contacts-staging.herokuapp.com/v0/contacts/search in 0.132849s
LogicalModel Log RESPONSE: {"collection":[],"total":0}
=> []
@dwaynemac
dwaynemac / google_contacts_client.rb
Created March 15, 2013 15:27
Google Contacts Clinet
require 'gdata'
class GoogleContactsClient
def initialize(username, password)
@username = username
@password = password
@client = GData::Client::Contacts.new
mongodb: ~/mongodb/bin/mongod
contacts: subcontract --rvm '1.9.2' --chdir ../contacts -- bundle exec unicorn -p 3002 -c ./config/unicorn.rb
activitystream: subcontract --rvm '1.9.2' --chdir ../activity_stream -- bundle exec unicorn -p 3003 -c ./config/unicorn.rb
accounts: subcontract --rvm 'ruby-1.9.3-p392' --chdir ../accounts -- bundle exec rails s -p 3001
class Direction
attr_accessor :current
def initialize(dir = nil)
@current = dir
end
def current
@current ||= :forward
end
@dwaynemac
dwaynemac / error.log
Created August 16, 2013 18:51
este request envió mail con triggers que no corresponden a esa account
2013-08-16T15:15:48.402351+00:00 app[web.1]: Started GET "/message_door" for 50.17.15.145 at 2013-08-16 15:15:48 +0000
2013-08-16T15:15:48.566605+00:00 app[web.1]: LogicalModel Log: 200 https://padma-contacts.herokuapp.com/v0/contacts/520e4022618966000b0000e4?select%5B0%5D=email&app%5Fkey=[SECRET] in 0.144759s
2013-08-16T15:15:48.566605+00:00 app[web.1]: LogicalModel Log RESPONSE: {"_id":"520e4022618966000b0000e4","email":"[email protected]"}
2013-08-16T15:15:49.028961+00:00 app[web.1]: Processing by MessageDoorController#catch as */*
2013-08-16T15:15:49.028961+00:00 app[web.1]: Rendered text template (0.0ms)
2013-08-16T15:15:49.028961+00:00 app[web.1]: Completed 200 OK in 617ms (Views: 0.6ms | ActiveRecord: 277.5ms)
2013-08-16T15:15:49.028961+00:00 app[web.1]: Parameters: {"key_name"=>"communication", "data"=>"{\"account_name\":\"oeste_go\",\"avoid_mailing_triggers\":false,\"communicated_at\":\"2012-12-26T23:00:00Z\",\"contact_id\":\"520e4022618966000b0000e4\",\"created_at\":\"2013-08-16T15:0
[2013-09-15 23:57:48] requirements_debian_update_system
requirements_debian_update_system ()
{
__rvm_try_sudo apt-get --quiet --yes update || {
typeset __ret=$?;
case ${__ret} in
100)
rvm_error "There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
@dwaynemac
dwaynemac / batch_overlay_images.rb
Last active December 23, 2015 08:49
Script to add a watermark to a directory of images.
ORIGINAL_DIR= 'fotos'
OUTPUT_DIR = 'overlayed'
OVERLAY_FILE = 'overlay.png'
class Composer
def initialize(file_name)
@file_name = file_name
[ec2-user@ip-10-29-27-56 contacts]$ gem install rmagick -v '2.13.2'
Fetching: rmagick-2.13.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
@account = FactoryGirl.create(:account)
PadmaAccount.stub!(:find).and_return(PadmaAccount.new(name: @account.name, enabled: true))
@user = FactoryGirl.create(:user)
pu = PadmaUser.new(username: @user.username)
User.any_instance.stub(:padma_enabled?).and_return true
User.any_instance.stub(:padma).and_return pu
sign_in(@user)
MyClass.stub(:metho_name) do |arg1, arg2|
"return-value-using-#{arg1}-#{arg2}-values"
end