This file contains hidden or 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 'lockfile' | |
| def timestamp | |
| Time.now.strftime('%x %X') | |
| end | |
| begin | |
| Lockfile.new('cron_mail_fetcher.lock', :retries => 0) do | |
| config = YAML.load_file("#{RAILS_ROOT}/config/mailer_daemon.yml") | |
| config = config[RAILS_ENV].to_options |
This file contains hidden or 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 PhotoEmail < ActiveRecord::Base | |
| belongs_to :doctor | |
| belongs_to :kase | |
| belongs_to :photo_email_status | |
| has_many :photos | |
| # Creates a new PhotoEmail from and incoming email |
This file contains hidden or 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 'mms2r' | |
| class IncomingMailHandler < ActionMailer::Base | |
| # Receive and process emails | |
| def receive(email) | |
| mms = MMS2R::Media.new(email) | |
| photos = get_images_from_email(mms) | |
| pemail = PhotoEmail.create_from_mail_handler(email, mms) | |
| logit "Processing email from #{pemail.sender} with subject #{pemail.subject} " |
This file contains hidden or 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 'mime/types' | |
| require 'RMagick' | |
| class Photo < ActiveRecord::Base | |
| establish_connection 'portal' | |
| set_table_name 'photos' | |
| belongs_to :kase | |
| belongs_to :doctor |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require File.dirname(__FILE__) + "/../ad_server_dependencies.rb" | |
| class StatKeyFix | |
| # This fixes ad stats that were incorrectly keyed in redis | |
| # according to ContentCacheAdvertisement#id instead of the | |
| # expected ContentInstance#id. The issue only affected ads | |
| # with a ContentCacheAdvertisement.id greater than 100,000 |
This file contains hidden or 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 'goliath' | |
| require 'em-synchrony' | |
| require 'em-synchrony/em-http' | |
| require 'nokogiri' | |
| class ReactorMulti < Goliath::API | |
| def response(env) |
This file contains hidden or 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 yield_with_default(name, content = nil, &block) | |
| if content_for?(name) | |
| content_for(name) | |
| else | |
| block_given? ? capture(&block) : content | |
| end | |
| end |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # vim: set syntax=ruby | |
| flag = false | |
| staged_files = `git diff --cached --name-only`.split | |
| ruby_files = staged_files.select{|s| s =~ /\.rb$/} | |
| ruby_files.each do |file| |
This file contains hidden or 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
| playlist = Playlist.create(name: 'My Playlist', org_id: Org.find_by_slug('vidpresso').id) | |
| # Create a bunch of entries in your dev database by sending a bunch of posts to air | |
| # Now you can move those to the newly created playlist | |
| playlist.entries << Entry.limit(5).order('id desc') | |
| # Make sure Foreman is started (foreman start -f Procfile.development) | |
| # And playback the playlist |
This file contains hidden or 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
| sudo apt-get install postgresql-9.1 postgresql-contrib-9.1 libpq-dev | |
| sudo su postgres | |
| psql | |
| (from psql console) | |
| create user ccpz with password 'ccpz'; | |
| create database ccpz OWNER ccpz ENCODING 'UTF8'; | |
| ALTER USER ccpz WITH SUPERUSER; | |
| \q |
OlderNewer