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
def create_unique_permalink | |
return unless should_create_permalink? | |
if send(self.class.permalink_field).to_s.empty? | |
send("#{self.class.permalink_field}=", create_permalink_for(self.class.permalink_attributes)) | |
end | |
limit = self.class.columns_hash[self.class.permalink_field].limit | |
base = send("#{self.class.permalink_field}=", send(self.class.permalink_field)[0..limit - 1]) | |
counter = 1 | |
# oh how i wish i could use a hash for conditions | |
conditions = ["#{self.class.permalink_field} = ?", base] |
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
def should_create_unique_permalink? | |
self.class.permalink_options[:unique] || 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
has_permalink :name , :unique=>false |
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
def to_param | |
self.id.to_s + "#{("-"+self.permalink) if self.permalink}" | |
# self.id This is default, prior to the implementation of Pemalinks | |
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
# This class a little tweaked by Satya (satya dot techsavy at gmail dot com) | |
# I have added a new option to the has_permalink method, :unique | |
# By default, :unique=>true | |
# By default, if a permalink already exists, permalink_fu adds a trailing integer to make it unique. | |
# Eg: satya, satya-1, satya-2,satya-3. | |
# If :unique is set to true (:unique=>true), then this behavior is not altered. | |
# In some cases, if we donot want the permalink to have the trailing integers, we need to set :unique=>false | |
# Eg: has_permalink :title , :unique=>false | |
# Eg: has_permalink :title, :permalink_field , :unique=>false |
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
# This class a little tweaked by Satya | |
# I have added a new option to the has_permalink method, :unique | |
# By default, :unique=>true | |
# By default, if a permalink already exists, permalink_fu adds a trailing integer to make it unique. | |
# Eg: satya, satya-1, satya-2,satya-3. | |
# If :unique is set to true (:unique=>true), then this behavior is not altered. | |
# In some cases, if we donot want the permalink to have the trailing integers, we need to set :unique=>false | |
# Eg: has_permalink :title , :unique=>false | |
# Eg: has_permalink :title, :permalink_field , :unique=>false |
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
if Object.const_defined?(:Iconv) | |
PermalinkFu.translation_to = 'ASCII//IGNORE//TRANSLIT' | |
PermalinkFu.translation_from = 'UTF-8' | |
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
if Object.const_defined?(:Iconv) | |
PermalinkFu.translation_to = 'ascii//translit//IGNORE' | |
PermalinkFu.translation_from = 'utf-8' | |
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 'httparty' | |
class ItunesVerification | |
include HTTParty | |
base_uri 'https://sandbox.itunes.apple.com' | |
default_params :output => 'json' | |
format :json | |
def self.verify_apple_receipt(apple_receipt) | |
post('/verifyReceipt', :body=>{'receipt-data' => apple_receipt}) |
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 'windows8_system' | |
require 'fetch_windows8_access_token' | |
require 'net/http' | |
require 'net/https' | |
class Windows8Notification < Windows8System | |
def self.process(device_uri,message) | |
puts "iha" | |
device_uri = "https://db3.notify.windows.com/?token=AgUAAAADoGlaM0THo74Q%2bJP7MkgBEJzYC7OyTwh59QmECe9MgwfwGSWLsMhkG%2bHF3JI3q3gySjc3keErqcwWYCN9Qwi2z7TdCMnYGb30huMkKrzB54%2fH73vxrYzp36SQScHazJA%3d" |
OlderNewer