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
responses = [] | |
assemble_responses = lambda result: responses.append(result) | |
pool = mp.Pool(processes=3) | |
if name == 'MyAlert': | |
pool.apply_async(process_alerts, ('Alerts'), callback = assemble_responses) | |
else: | |
pool.apply_async(process_tickets, (name, 'Tickets'), callback = assemble_responses) | |
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 index | |
@studies = Study.search(params[:term]) | |
respond_to do |format| | |
format.html | |
format.json { render json: @studies.map(&:title) } | |
end | |
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
<%= form_with(model: study, url: yield(:url), local: true) do |f| %> | |
... |
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
sample = { 'test': 'this is a test'} | |
for s in sample: | |
for msg in sample[s]: print "<li>%s</li" % msg | |
<li>t</li> | |
<li>h</li> | |
<li>i</li> | |
<li>s</li> | |
<li> </li> | |
<li>i</li> |
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 AnimalMixin | |
class << self | |
def included(base) | |
base.extend ClassMethods | |
end | |
end | |
module ClassMethods | |
def inheritable_attributes(*args) | |
@inheritable_attributes ||= [:inheritable_attributes] |
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
CustomerItem:123 | |
CustomerItem:456 | |
CustomerItem:789 | |
CustomerItem:098 | |
'CustomerItem:ids' '123, 456, 789, 098' |
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 PodioAbstractItem < Podio::Item | |
def self.fetch_all_items(app_id) | |
Podio::Item.find_by_filter_values(app_id) | |
end | |
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
config.podio_client_id = ENV['PODIO_CLIENT_ID'] |
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
Podio.setup( | |
api_url: 'https://api.podio.com', | |
api_key: Rails.application.config.podio_client_id, | |
api_secret: Rails.application.config.podio_client_secret | |
) | |
$podio = Podio.client.authenticate_with_credentials( | |
Rails.application.config.podio_username, | |
Rails.application.config.podio_password | |
) |
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
Podio.setup( | |
api_url: 'https://api.podio.com', | |
api_key: Rails.application.config.podio_client_id, | |
api_secret: Rails.application.config.podio_client_secret | |
) | |
Podio.client.authenticate_with_credentials( | |
Rails.application.config.podio_username, | |
Rails.application.config.podio_password | |
) |
NewerOlder