This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has_and_belongs_to_many :followers, | |
class_name: 'User', | |
foreign_key: 'follower_id', | |
join_table: 'followers_followees' | |
has_and_belongs_to_many :followees, | |
class_name: 'User', | |
foreign_key: 'followee_id', | |
join_table: 'followers_followees' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contacts::ApplicationController | |
respond_to :json, :html | |
def index | |
respond_with Contacts.all | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Download and install Qt SDK 4.8 (http://qt.nokia.com/downloads/) | |
2. Build Smokegen (https://projects.kde.org/projects/kde/kdebindings/smoke/smokegen/repository) | |
3. Build Smokeqt (https://projects.kde.org/projects/kde/kdebindings/smoke/smokeqt/repository) | |
4. Build (https://projects.kde.org/projects/kde/kdebindings/ruby/qtruby/repository) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo << 'bar' do | |
something | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
menu = Menu.new | |
menu << 'Quit' do | |
$app.quit | |
end | |
#this appends a menu item 'Quit' which exits the application when clicked |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sessions = {} | |
class Test | |
def initialize(session, &blk) | |
$last_session = session | |
yield | |
end | |
end | |
class User | |
def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Standard QtRuby: | |
Menu.new do | |
action = Action.new | |
action.text = 'say hi' | |
action.connect(SIGNAL :clicked) { puts 'hi' } | |
add_action(action) | |
action_quit = Action.new | |
action_quit.text = 'quit' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def full_name | |
unless @_full_name | |
return @first_name + ' ' + @last_name | |
end | |
@_full_name | |
end | |
def full_name=(full_name) | |
@_full_name = full_name | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
most_recent: (id)-> | |
@collection ||= new ProfileCollection | |
unless @collection.get(id) | |
@collection.fetch | |
success: => | |
if id | |
@display @collection.get(id) | |
else | |
@display @collection.first() | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href]').click -> | |
$('.menu li').removeClass('active') | |
$(this).parent('li').addClass('active') | |
MissNk.profile_router.navigate $(this).attr('href'), trigger: true | |
false |