January 2012
3 posts
Add facebook app to page tab
When Facebook remove the own apps page, he also kill easy opportunity to add this app to your facebook page tab. Now, you can do it easy with this magick url: https://www.facebook.com/dialog/pagetab?app_id=[APP_ID]&display=popup&next=https://[URL_TO_YOUR_APP_ON_YOUR_SERVER]
Jan 17th
4 tags
Ruby wrapper for startmobile sms service →
This gem provide the easy way to send and check a single sms with startmobile.com.ua service. Install gem 'startmobile_sms' Configure StartmobileSms.setup do |config| config.login = 'login' config.password = 'password' config.out_number = 'out_number' end Usage # Send single sms (out_number is optional) sms_id = StartmobileSms.send(:phone => '30971234567', :text => 'Hello!',...
Jan 17th
16 notes
Friendly_id. Don't change slug on update
If you don’t want to regenerate you slug when model change friendly_id field, use this hook: # config/initializers/add_static_to_friendly_id.rb module FriendlyId module Static def should_generate_new_friendly_id? new_record? end end end # your model class MyModel < ActiveRecord::Base extend FriendlyId friendly_id :something, :use => [:slugged, :static] end
Jan 16th
November 2011
1 post
5 tags
Select album photos likes from Facebook by FQL...
I have Facebook contest album with many photos. And I need to display rating of this photos by user likes. This FQL query get a list of all likes (user_ids) by all photos: SELECT user_id, object_id FROM like WHERE object_id IN (SELECT object_id FROM photo WHERE aid=’139307129471375_51887’ limit 5000) limit 100000 Then you can order results by object_id and sort...
Nov 14th
2 notes
August 2011
3 posts
Create nice design for you project without... →
Aug 21st
Gem MetaWhere - nice sql quering →
Aug 17th
Recover MySQL root Password →
After last Unbuntu update my Mysql server lost root password. This link save few hours of my day))
Aug 1st
July 2011
1 post
5 tags
Group_by example in MongoMapper
This is simple way to make a request on a column grouping in MongoMapper like as GROUP_BY in SQL:
Jul 6th
11 notes
June 2011
1 post
Very nice tools for js development →
Jun 14th
May 2011
1 post
Cyrillic length problem
Ruby 1.8.7 (Ruby Enterprise Edition): “string”.length # => 6 “строка”.length # => 12 Solution: “string”.split(//).size # => 6 “строка”.split(//).size # => 6
May 18th
March 2011
4 posts
7 tags
Publish stream in Facebook & Twitter with OmniAuth
First of all, include OmniAuth to your rails app by this railscast or this. Then add to Gemfile this gem: gem ‘fb_graph’, ‘1.5.4’ After, you should turn on permission in your apps: for Facebook: for Twitter: When your login from OmniAuth, social app ask your permission on update wall in Facebook and post tweet in Twitter. Paste to you authentication model (my...
Mar 26th
3 notes
Overwrite Devise user update with current_password
If you don’t need to check current_password when user is updating itself, then you can overwrite standart Devise method update_with_password:
Mar 25th
Using Redis with Ruby on Rails →
User Friendships && High Score Table
Mar 25th
OmniAuth - Twitter: OAuth::Unauthorized (401...
Такое случается, когда в twitter app выбираем тип приложения Browser, но, при этом, не указываем Callback URL. Свитер автоматом меняет тип приложения на Client, когда поле урла колбека пустое. Так что Callback URL - обязательное поле.
Mar 1st
February 2011
3 posts
5 tags
Rails 2 routes redirect
Редирект странички средствами Rails:
Feb 28th
38 notes
Caching Views is Not the View’s Job! →
Хорошая статья о том, как правильно кэшировать фрагменты (и не только) в Rails с помощью cells. class CartCell < Cell::Rails cache :show   def show(items) @items = items render end
Feb 17th
Building a Facebook Application →
Отлично иллюстрированый tutorial создания приложения на Facebook с помощью Heroku + Sinatra.
Feb 17th