This file contains 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
require 'date' | |
def days_remaining_in_month | |
day_of_month = Time.now.day | |
(days_in_month(Time.now.year, Time.now.month) - day_of_month) | |
end | |
def prorated_price_today(price) | |
day_of_month = Time.now.day | |
percent_of_month_remaining = BigDecimal(days_remaining_in_month.to_s) / BigDecimal(days_in_month(Time.now.year, Time.now.month).to_s) |
This file contains 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
function cardval() { | |
// validate presence of first name, last name, billing address and CVV. | |
if ($("#subscription_first_name").val().length == 0 || $("#subscription_last_name").val().length == 0 || $("#subscription_address").val().length == 0 || $("#subscription_city").val().length == 0 || $("#subscription_state").val().length == 0 || $("#subscription_zipcode").val().length == 0 || $("#subscription_cvv2").val().length == 0) { | |
alert("All fields on the form must be filled out. Please complete the form and try again."); | |
return false; | |
} | |
// check CVV2 is 3 or 4 digits | |
var re = new RegExp(/^\d{3,4}$/); |
This file contains 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
devise_for :admins, :controllers => { :registrations => ‘admin/registrations’, :sessions => ‘admins/sessions’ } | |
# other routes here | |
devise_for :admins # oops, this won't work! |
This file contains 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
<link href="/stylesheets/mobile/tablet.css?1308515841" media="only screen and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1)" rel="stylesheet" type="text/css" /> | |
<link href="/stylesheets/mobile/mobile.css?1308364516" media="only screen and (max-device-width: 480px)" rel="stylesheet" type="text/css" /> |
This file contains 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
cal = Calendar.new | |
# normal iCalender stuff here... | |
cal.custom_property("METHOD", "PUBLISH") | |
cal.custom_property("X-MS-OLK-FORCEINSPECTOROPEN", "TRUE") |
This file contains 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
attachments['meeting.ics'] = { :content_type => 'text/calendar; method=REQUEST', :content => notification.ical_text, :encoding => '8bit' } |
This file contains 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
--- iui.js | |
+++ iui.js | |
@@ -677,12 +677,12 @@ function orientChangeHandler() | |
switch(orientation) | |
{ | |
case 0: | |
- setOrientation(portraitVal); | |
+ setOrientationAndScroll(portraitVal); | |
break; | |
This file contains 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
module ActiveRecord | |
class Base | |
def can_delete? | |
this_model_name = self.class.name | |
associations = Kernel.const_get(this_model_name).reflect_on_all_associations | |
has_one_models = associations.map{ |x| x.name.to_s if x.macro == :has_one }.compact | |
has_one_models.each do |child| | |
if self.send(child).present? | |
return false | |
end |
This file contains 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 InstitutionLogin | |
include XML::Mapping | |
# added namespaces to make root element compliant with recipients's expectation | |
def post_save xml, options={:mapping=>:_default} | |
xml.root.add_attributes("xmlns"=>"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1") | |
xml.root.add_namespace "xsi", "http://www.w3.org/2001/XMLSchema-instance" | |
xml.root.add_namespace "xsd", "http://www.w3.org/2001/XMLSchema" | |
end | |
self.root_element_name "InstitutionLogin" | |
object_node :credentials, "credentials", :default_value => nil |
This file contains 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. launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist | |
2. mv /usr/local/var/postgres9 /usr/local/var/postgres90 | |
3. curl https://raw.github.com/fragility/homebrew/737af01178590950749cf5e841f2d086c57c5a80/Library/Formula/postgresql.rb > /usr/local/Library/Formula/postgresql.rb | |
4. brew install postgresql # if this doesn't work, homebrew may have an existing installation. you can try a brew upgrade postgresql but some of the instructions that follow may need to change... | |
4b. at this point, check to make sure that the postgres binaries are linked and in the path correctly. try doing psql -V and confirm it shows version 9.2. If it doesn't, adjust your path so /usr/local/Cellar/postgresql/9.2.0/bin/ is in front of the offending locations with postgres binaries in them or fight with brew link to fix it. | |
5. initdb /usr/local/var/postgres -E utf8 | |
6. Edit ~/Library/LaunchAgents/org.postgresql.postgres.plist file to point to your new locations, probably looking like this: | |
<?xml version="1.0" encodi |
OlderNewer