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
help(str) |
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
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install (64 bit) | |
# updated to PostGIS 2.0.1 | |
# add the ubuntu gis ppa | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
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
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS 2.0 and pgRouting on a clean Ubuntu 12.04 install (64 bit) | |
# updated to PostGIS 2.0.1 | |
# add the ubuntu gis ppa | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
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
before_validation :upcase_title | |
validates_presence_of :title | |
def upcase_title | |
title.upcase if title.present? | |
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
require "rubygems" | |
require "active_merchant" | |
ActiveMerchant::Billing::Base.mode = :test | |
gateway = ActiveMerchant::Billing::PaypalGateway.new( | |
:login => "seller_1229899173_biz_api1.railscasts.com", | |
:password => "FXWU58S7KXFC6HBE", | |
:signature => "AGjv6SW.mTiKxtkm6L9DcSUCUgePAUDQ3L-kTdszkPG8mRfjaRZDYtSu" | |
) |
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
describe("display alert for unsaved publisher content", function(){ | |
it('should display confirm dialog if text exists in status message', function(){ | |
$('#status_message_fake_text').val('Hello world'); | |
spyOn(window, 'confirm'); | |
$(window).trigger('confirm') | |
expect(window.confirm).toHaveBeenCalled(); | |
}); | |
}); |
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
$(window).on('beforeunload unload', _.bind(_this._unsavedPublisherWarning, _this)); | |
_unsavedPublisherWarning : function(){ | |
var publisherTextLength = this.el_input.val().trim().length; | |
if(publisherTextLength){ | |
return "navigation_warning"; | |
} | |
} |
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
describe("display alert for unsaved publisher content", function(){ | |
it('should display confirm dialog if text exists in status message', function(){ | |
$('#status_message_fake_text').val('Hello world'); | |
spyOn(window, 'confirm'); | |
$(window).trigger('beforeunload') | |
expect(window.confirm).toHaveBeenCalled(); | |
}); | |
}); |
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
line = " Hello World!! " | |
print line.strip() #remove empty spaces from start and end | |
print line.lstrip() #remove empty spaces from start | |
print line.rstrip() #remove empty spaces from 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
mylist = ['apple', 'orange', 'mango'] | |
print ', '.join(mylist) | |
mylist = [1, 2, 3] | |
print str(mylist).strip('[]') | |
mylist = ['1', '2', '3'] | |
print [int(item) for item in mylist] |
OlderNewer