Skip to content

Instantly share code, notes, and snippets.

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
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
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)
def new_users_for_the_last_week
"#{User.where(created_at: 7.days.ago..Date.today).count}"
end
service: "#{service}".to_s - refactoring
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'
# 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
with 'C*'
"João+André".bytes.pack('C*').force_encoding('UTF-8')
with 'U*'
'Café'.codepoints.pack('U*')
@arturdent
arturdent / introrx.md
Last active August 29, 2015 14:12 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.