Skip to content

Instantly share code, notes, and snippets.

Avatar
💁‍♀️
I try to solve all my problems with a single SQL query.

Gabriela D'Ávila Ferrara gabidavila

💁‍♀️
I try to solve all my problems with a single SQL query.
View GitHub Profile
@gabidavila
gabidavila / challenge.sql
Last active Aug 21, 2020
How is your internal query execution?
View challenge.sql
use blog;
-- Count posts id
SELECT COUNT(DISTINCT id) FROM posts;
-- => 7
-- count posts id
SELECT COUNT(DISTINCT post_id) from comments;
-- => 3
@gabidavila
gabidavila / Homestead.rb
Last active May 16, 2020 — forked from svpernova09/Homestead.rb
Ruby Array / Hash Logic to enable / disable Ubuntu Services
View Homestead.rb
if settings.has_key?('services')
settings['services'].each do |service|
service['enabled'].each do |enable_service|
config.vm.provision "shell", inline: "sudo systemctl enable #{enable_service}"
end if service.include?('enabled')
service['disabled'].each do |disable_service|
config.vm.provision "shell", inline: "sudo systemctl disable #{disable_service}"
end if service.include?('disabled')
end
@gabidavila
gabidavila / Homestead.rb
Created May 16, 2020 — forked from svpernova09/Homestead.rb
Ruby Array / Hash Logic to enable / disable Ubuntu Services
View Homestead.rb
# Snippet
# Enable Services
if settings.has_key?('services')
settings['services'].each do |service|
if service.include?('enabled')
enable = service['enabled']
enable.each do |enable_service|
config.vm.provision "shell", inline: "sudo systemctl enable #{enable_service}"
end
end
View AllAboutDatabase.md

All about database

Because you know I am all about database
database, database, but no trigger (4x)

I am about database, base, base

Yeah it ain't clear
This font is size 2
@gabidavila
gabidavila / Dockerfile
Last active Oct 11, 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",
You can’t perform that action at this time.