Skip to content

Instantly share code, notes, and snippets.

# app/controllers/admin/users_controller.rb:33
.....
def collection
@users ||= apply_scopes(User).includes(:social_profiles).order('created_at DESC').page(params[:page]).per(20)
end
# app/views/admin/index.html.haml
logs:
social_interaction: 'Error on Social Interaction with %{service}'
validation: 'Error on validation in InteractionRouter'
save_date: 'Cant save data to dump'
refresh_tokens: 'Error on Refresh Tokens'
check_tokens: 'Error on Check Tokens for service'
grab_endpoint: 'Error on Grab endpoint for %{service}'
grab_likes: 'Error on grabbing likes'
grab_attachments: 'Error on grabbing attachments'
rebuild_activities: 'Rebuild activities error'
service: "#{service}".to_s - refactoring
def new_users_for_the_last_week
"#{User.where(created_at: 7.days.ago..Date.today).count}"
end
module AdminDashboardHelper
def users_registered_today
"#{users_registered_by_date(Date.today)} (#{social_profiles_created_by_date(Date.today)})"
end
def users_registered_by_date(date)
User.where('created_at > ?', date.beginning_of_day).count
end
def social_profiles_created_by_date(date)
1) Processor::Linkedin::News#run save data should == #<SocialProfile id: nil, user_id: 10, service_name: "linkedin", uid: "4mZ59ISv0H", created_at: "2014-04-29 06:55:31", updated_at: "2014-04-29 06:55:31", profileble_id: nil, profileble_type: nil, access_token: "b67fc7997979e8175cd2e3d63a66e24e14982b98", secret_key: "1de50c3c95fb952e362fbede63ab63f22ebdec48", active: false, invalid_tokens: false, expires_at: nil, obtained_archive: false>
Failure/Error: post.social_profile.should == @social_profile
expected: #<SocialProfile id: nil, user_id: 10, service_name: "linkedin", uid: "4mZ59ISv0H", created_at: "2014-04-29 06:55:31", updated_at: "2014-04-29 06:55:31", profileble_id: nil, profileble_type: nil, access_token: "b67fc7997979e8175cd2e3d63a66e24e14982b98", secret_key: "1de50c3c95fb952e362fbede63ab63f22ebdec48", active: false, invalid_tokens: false, expires_at: nil, obtained_archive: false>
got: #<SocialProfile id: 4, user_id: 10, service_name: "linkedin", uid: "4mZ59ISv0H", crea

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = '[email protected]'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
# encoding: utf-8
require 'spec_helper'
describe Manage::CampaignsController do
context 'media_planner role' do
before(:each) do
load_cnx35_toyota!