rails new contentmaster -d mysql
Arquivo de configuração do banco: config/database.yml
| require 'httparty' | |
| class WeatherstackClient | |
| API_BASE = "http://api.weatherstack.com" | |
| API_KEY = "" | |
| def current_weather(city) | |
| url = "#{API_BASE}/current" | |
| response = HTTParty.get(url, query: { |
| service: nice_project | |
| image: joseanchieta/nice_project | |
| servers: | |
| web: | |
| - 192.168.0.1 | |
| registry: | |
| username: joseanchieta |
| def flood_fill(image, x, y, new_color) | |
| target_color = image[x][y] | |
| fill(image, x, y, target_color, new_color) | |
| end | |
| def fill(image, x, y, target_color, new_color) | |
| return if x < 0 || x >= image.length || y < 0 || y >= image[0].length | |
| return if image[x][y] != target_color | |
| return if image[x][y] == new_color |
| -- Create database structure | |
| CREATE TABLE SUPPLIER ( | |
| SUPPLIER_CODE VARCHAR(255), | |
| SUPPLIER_NAME VARCHAR(255), | |
| CITY VARCHAR(255) | |
| ); | |
| CREATE TABLE PART ( | |
| PART_CODE VARCHAR(255), | |
| NAME_PART VARCHAR(255), |
| def search_phone_by_name(list, name) | |
| left = 0 | |
| right = list.length - 1 | |
| while left <= right | |
| mid = (left + right) / 2 | |
| current_name = list[mid][:name] | |
| if current_name == name | |
| return list[mid][:phone] |
| def palindrome?(word) | |
| left = 0 | |
| right = word.length - 1 | |
| while left < right | |
| return false if word[left] != word[right] | |
| left += 1 | |
| right -= 1 | |
| end |
| centre_id | brand | center_status | address_line1 | address_line2 | address_line3 | city | state_or_province | zip_or_postal_code | country_iso_code | longitude | latitude | address_number | building_name | street_name | floor_numbers | suite_numbers | unit_numbers | product_category | product_name | building_description | local_area_description | total_building_size | area_size_unit | min_desks | max_desks | centre_open_date | min_term | max_term | min_cost | max_cost | currency | featured_image | external_building_image | high_res_images | high_res_image_tags | low_res_images | low_res_image_tags | feature_24_hour_access | feature_24_hour_cctv_monitoring | feature_airport_location | feature_bicycle_storage | feature_breakout_areas | feature_business_park_location | feature_city_town_centre | feature_day_care | feature_disabled_facilities | feature_double_glazing | feature_elevator | feature_gym_and_fitness_room | feature_lounge_area | feature_major_transport_links | feature_meeting_rooms | feature_on_site_dry_cleaning | feature_on_site_lunch_restaurant | feature_outside_seating_area_terrace | feature_parking | feature_ |
|---|
| centre_id | brand | center_status | address_line1 | address_line2 | address_line3 | city | state_or_province | zip_or_postal_code | country_iso_code | longitude | latitude | address_number | building_name | street_name | floor_numbers | suite_numbers | unit_numbers | product_category | product_name | building_description | local_area_description | total_building_size | area_size_unit | min_desks | max_desks | centre_open_date | min_term | max_term | min_cost | max_cost | currency | featured_image | external_building_image | high_res_images | high_res_image_tags | low_res_images | low_res_image_tags | feature_24_hour_access | feature_24_hour_cctv_monitoring | feature_airport_location | feature_bicycle_storage | feature_breakout_areas | feature_business_park_location | feature_city_town_centre | feature_day_care | feature_disabled_facilities | feature_double_glazing | feature_elevator | feature_gym_and_fitness_room | feature_lounge_area | feature_major_transport_links | feature_meeting_rooms | feature_on_site_dry_cleaning | feature_on_site_lunch_restaurant | feature_outside_seating_area_terrace | feature_parking | feature_ |
|---|