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
| ProductType.all.each {|p| p.upload.asset.reprocess! } |
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 /etc/init.d/nginx start | |
| sudo /etc/init.d/nginx stop |
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 under_minimum_order_size?(min = minimum_order_size, total = total_quantity_in_instance) | |
| errors.add(:under_min, "Total quantity must be over #{min}") if total < min | |
| end | |
| def total_quantity_in_instance(total = 0) | |
| self.custom_sizes.each do |custom_size| | |
| total += custom_size.quantity.to_i | |
| end | |
| total | |
| 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
| has_attached_file :image, | |
| :styles => { :medium => "300x300>", :thumb => "100x100>" } |
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
| rake some_tasks:my_task class=User |
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
| task my_task: :environment do | |
| klass_name = ENV['class'] #string | |
| klass = klass_name.classify.constantize #find class example | |
| 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
| ###gemfile | |
| gem 'paperclip' ## 3.5.1, also 3.4.2 previously | |
| gem 'delayed_paperclip' | |
| gem 'sidekiq', '2.6.4' | |
| ### image.rb | |
| attr_accessible :photo_processing | |
| has_attached_file :photo, | |
| styles: { |
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
| jobs = Sidekiq.redis { |r| r.zrange("schedule", 0, -1, {withscores: true}) } | |
| Sidekiq.redis { |r| jobs.each {|j| r.zrem "schedule", j } } | |
| Sidekiq.redis { |r| r.FLUSHDB } |
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
| SELECT "pid","application_name", "backend_start", "xact_start", "query_start", "state_change", "state" FROM pg_stat_activity; |
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
| ['ACTON','ADELANTO','AGOURA HILLS','ALAMEDA','ALAMO','ALBANY','ALHAMBRA','ALISO VIEJO','ALMANOR','ALONDRA PARK','ALPAUGH','ALPINE','ALPINE VILLAGE','ALTADENA','ALTA SIERRA','ALTURAS','ALUM ROCK','AMADOR CITY','AMERICAN CANYON','AMESTI','ANAHEIM','ANDERSON','ANGELS CITY','ANGWIN','ANTIOCH','APPLE VALLEY','APTOS','APTOS HILLS-LARKIN VALLEY','ARBUCKLE','ARCADIA','ARCATA','ARDEN-ARCADE','ARMONA','ARNOLD','AROMAS','ARROYO GRANDE','ARTESIA','ARVIN','ASHLAND','ATASCADERO','ATHERTON','ATWATER','AUBERRY','AUBURN','AUGUST','AVALON','AVENAL','AVERY','AVOCADO HEIGHTS','AZUSA','BAKERSFIELD','BALDWIN PARK','BANNING','BARSTOW','BAY POINT','BAYVIEW','BAYVIEW-MONTALVIN','BAYWOOD-LOS OSOS','BEALE AFB','BEAR VALLEY','BEAR VALLEY SPRINGS','BEAUMONT','BECKWOURTH','BELDEN','BELL','BELLFLOWER','BELL GARDENS','BELMONT','BELVEDERE','BENICIA','BEN LOMOND','BERKELEY','BERMUDA DUNES','BERTSCH-OCEANVIEW','BETHEL ISLAND','BEVERLY HILLS','BIG BEAR CITY','BIG BEAR LAKE','BIG BEND','BIGGS','BIG PINE','BIG RIVER','BIOLA','BISHOP','BLACKHAWK-C |