Skip to content

Instantly share code, notes, and snippets.

View DemitryT's full-sized avatar

Demitry Toumilovich DemitryT

View GitHub Profile
@DemitryT
DemitryT / migration.rb
Created September 24, 2012 18:02
migration
class ChangeAgentProfilesContactForm < ActiveRecord::Migration
def self.up
change_column :settings, :agent_profiles_contact_form, :boolean, :default => true, :null => false
end
def self.down
change_column :settings, :agent_profiles_contact_form, :boolean
end
end
@DemitryT
DemitryT / test.rb
Created November 2, 2012 20:57
test.rb
def is_mobile_device?
if current_company
current_company.mobile_optimized? && !session[:full_site].present? && super || session[:mobile_view].present?
else
!session[:full_site].present? && super || session[:mobile_view].present?
end
end
@DemitryT
DemitryT / lightbox.js
Created December 12, 2012 20:21
new lightbox js
/*
Lightbox v2.51
by Lokesh Dhakar - http://www.lokeshdhakar.com
For more information, visit:
http://lokeshdhakar.com/projects/lightbox2/
Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
- free for use in both personal and commercial projects
@DemitryT
DemitryT / theory.rb
Last active August 29, 2015 14:11
theory.rb
class User < ActiveRecord::Base
MAILCHIMP_API_KEY = 'm23lm092m3'
# You shouldn't add these credentials in the model or even check these into github. They should either
# be added via the Heroku toolbelt to the settings or at least stored in a separate settings file.
has_many :orders
has_many :packages, through: :orders
before_save :assign_referral_code, on: :create
{
"id": "eb85349d-03c3-44f4-a77b-824f7221d116",
"imp": [
{
"id": "eb85349d-03c3-44f4-a77b-824f7221d116",
"banner": {
"h": 250,
"w": 300,
"ext": {
"bcont": [ 1, 3, 4, 6, 8, 10, 11, 12, 14, 15 ],
@DemitryT
DemitryT / test.rb
Created November 20, 2015 09:34
test
test