Skip to content

Instantly share code, notes, and snippets.

View tanelsuurhans's full-sized avatar

Tanel Suurhans tanelsuurhans

  • ID.me
  • United States
View GitHub Profile
@tanelsuurhans
tanelsuurhans / sieve.rb
Last active August 29, 2015 13:55 — forked from anonymous/sieve.rb
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
#!/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
class MyModel < ActiveRecord::Base
attr_accessible :my_attribute
def my_attribute=(value)
# do something else here...
write_attribute(:my_attribute, value)
end
end
def minimum_bet_validation
errors.add(:base, _("minimum_bet", :value => 10)) if name == Setting::MINIMUM_BET && value.to_i < 10
end
if value.to_i < 10
$ ->
if $('h1.claim a').length > 0
$.mobile.ajaxEnabled = false
if $('.purchase_form').length > 0
$.mobile.ajaxEnabled = false
# 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
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