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
| { | |
| "data": [ | |
| { | |
| "id": 6, | |
| "banner_image": null, | |
| "created_at": "2009-04-08 10:43:22 -0400", | |
| "description": "Distance from front to back of the wall as seen from above. Also referred to as the height.\n\n", | |
| "description_de": "Das ist der Abstand von der Vorderseite bis zu der Hinterseite der Wand, von oben gesehen. Also, auch Höhe genannt.\n\n", | |
| "description_es": "La distancia desde la parte delantera hasta la parte trasera del muro, visto desde arriba. También se le refiere como la altura.\n\n\n\n\n", | |
| "description_fr": "Distance de l'avant vers l'arrière du mur vue de dessus. Également appelée hauteur.\n\n", |
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 "csv" | |
| headers = %w[identifier address other] | |
| model = Model | |
| CSV.open("model_export.csv", "wb") do |csv| | |
| csv << headers | |
| model.select(*headers).find_each do |row| | |
| csv << row.attributes.except("id").values | |
| 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
| openapi: 3.0.1 | |
| info: | |
| title: Webhooks API | |
| version: '1.0' | |
| description: API documentation for handling webhooks. | |
| paths: | |
| /api/webhooks/rently: | |
| post: | |
| summary: Handle Rently webhook events | |
| description: Receives and processes webhook events from Rently. |
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 Array | |
| def to_csv(csv_filename="hash.csv") | |
| require 'csv' | |
| CSV.open(csv_filename, "wb") do |csv| | |
| csv << first.keys # adds the attributes name on the first line | |
| self.each do |hash| | |
| csv << hash.values | |
| end | |
| 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
| ```ruby | |
| record = Model.where("data->'$.somearray[0].email' = ?", email).first | |
| ``` |
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 | |
| TABLE_NAME AS `Table`, | |
| ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)` | |
| FROM | |
| information_schema.TABLES | |
| WHERE | |
| TABLE_SCHEMA = "mydatabase" | |
| ORDER BY | |
| (DATA_LENGTH + INDEX_LENGTH) | |
| DESC; |
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
| DROP extension postgis CASCADE; | |
| /* | |
| drop cascades to column shape of table MYTABLE_points | |
| drop cascades to column shape of table MYTABLE_areas | |
| */ | |
| /* Upgrade PostgreSQL */ | |
| CREATE extension postgis; |
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 | |
| TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_DEFAULT | |
| FROM | |
| INFORMATION_SCHEMA.COLUMNS | |
| WHERE | |
| TABLE_NAME='Xxx'; |
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
| #!/bin/bash | |
| # -d for no data, just structure | |
| # -t for no create, just data | |
| # --ignore-table=name1 --ignore-table=name2 | |
| # --skip-comments | |
| # include table names after DATABASE | |
| mysqldump -u USER -h HOST -p DATABASE | gzip > DATABASE.sql.gz | |
| # load |
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
| rails_version = '6.1.3' | |
| # Include rails specific gems | |
| # We need this until https://github.com/rails/rails/issues/41750 is resolved | |
| gem 'actioncable', rails_version | |
| gem 'actionmailer', rails_version | |
| gem 'actionpack', rails_version | |
| gem 'actionview', rails_version | |
| gem 'activejob', rails_version | |
| gem 'activemodel', rails_version | |
| gem 'activerecord', rails_version |
NewerOlder