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 can_delete?(object) | |
can_delete_by_core_role?(object) || | |
can_delete_by_owner?(object) || | |
can_delete_by_zone_role?(object) || | |
can_delete_by_access_profile?(object) | |
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
#!/usr/bin/env ruby | |
#------------------------------------------------------------------------------ | |
# Aggregate Print useful information from /proc/[pid]/smaps | |
# | |
# pss - Roughly the amount of memory that is "really" being used by the pid | |
# swap - Amount of swap this process is currently using | |
# | |
# Reference: | |
# http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt#361 |
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 MyModel < ActiveRecord::Base | |
attr_accessible :my_attribute | |
def my_attribute=(value) | |
# do something else here... | |
write_attribute(:my_attribute, value) | |
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
def minimum_bet_validation | |
errors.add(:base, _("minimum_bet", :value => 10)) if name == Setting::MINIMUM_BET && value.to_i < 10 | |
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
if value.to_i < 10 |
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
$ -> | |
if $('h1.claim a').length > 0 | |
$.mobile.ajaxEnabled = false | |
if $('.purchase_form').length > 0 | |
$.mobile.ajaxEnabled = false |
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
# This is what I'd _like_ to do. | |
# link_to user_album(user, album) | |
# link_to user_blog(user) | |
resources :users, :path => '' do | |
resources :albums | |
resources :blogs | |
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
class ImportController << ApplicationController | |
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
#THIS METHOD TO SEND USER TO THE GOOGLE AUTHENTICATION PAGE. | |
def authenticate | |
# initiate authentication w/ gmail | |
# create url with url-encoded params to initiate connection with contacts api |