Skip to content

Instantly share code, notes, and snippets.

:octocat:
I try to solve all my problems with a single SQL query.

Gabriela D'Ávila Ferrara gabidavila

Block or report user

Report or block gabidavila

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gabidavila
gabidavila / Dockerfile
Last active Apr 24, 2019
Cloud Run example.
View Dockerfile
FROM composer:latest as composer
COPY src /var/www/html
WORKDIR /var/www/html
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN composer install && composer dump-autoload
RUN composer require google/cloud-language
View BigQuery JDBC.md

Connection string for JDBC driver on DataGrip

jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId={project:param};OAuthType=0;OAuthServiceAcctEmail={email:param};OAuthPvtKeyPath={secret:param}
View fizzbuzz.sql
WITH RECURSIVE fizz_buzz (sequence, modulo_3, modulo_5) AS (
SELECT 1, CAST('' AS CHAR(4)), CAST('' AS CHAR(5))
UNION ALL
SELECT sequence + 1,
IF(MOD(sequence + 1, 3) = 0, 'Fizz', ''),
IF(MOD(sequence + 1, 5) = 0, 'Buzz', '')
FROM fizz_buzz
WHERE sequence < 100
)
View binary_tree.sql
WITH RECURSIVE traversed (id, name, path, `left`, `right`) AS (
SELECT id,
name,
CAST(JSON_ARRAY(id) AS JSON),
`left`,
`right`
FROM binary_tree
WHERE id = 1
UNION
SELECT b.id,
View VisionTranslateLanguageAPI.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View xdevapi4.js
/**
* Responds to any HTTP request that can provide a "message" field in the body.
*
* @param {!Object} req Cloud Function request context.
* @param {!Object} res Cloud Function response context.
*/
const options = {
host: "your ip address",
port: 33060,
password: "your password",
View xdevapi3.js
const mysqlx = require('@mysql/xdevapi');
const options = require('./config')
mysqlx.getSession(options)
.then((session) => {
const db = session.getSchema("worldcup");
let teamsCollection = db.getCollection("teams_2018");
return teamsCollection.find("name = :country1 OR name = :country2")
.bind("country1", "Brazil")
.bind("country2", "England")
View xdevapi2.js
[
4,
"Brazil ",
{
"players": [{
"id": 70,
"dob": "05.03.1993",
"club": "FC Shakhtar Donetsk (UKR)",
"name": "FRED",
"height": 169,
View xdevapi1.js
const mysqlx = require('@mysql/xdevapi');
const options = require('./config')
mysqlx.getSession(options)
.then((session) => {
const db = session.getSchema("worldcup");
const tableTeams = db.getTable("teams");
return tableTeams;
})
View xdevapi_1.sql
DESCRIBE `users`;
-- +-------------+--------------+------+-----+-------------------+-----------------------------+
-- | Field | Type | Null | Key | Default | Extra |
-- +-------------+--------------+------+-----+-------------------+-----------------------------+
-- | id | int(11) | NO | PRI | NULL | auto_increment |
-- | id_str | varchar(255) | NO | UNI | NULL | |
-- | screen_name | varchar(255) | NO | MUL | NULL | |
-- | response | json | NO | | NULL | |
-- | created_at | datetime | NO | | CURRENT_TIMESTAMP | |
You can’t perform that action at this time.